Python operation Azure Virtual machine download Microsoft's Python SDK
pip install azure
However, the default azure
interface is azure
not valid for domestic, the modified Python27\Lib\site-packages\azure\__init__.py
file points toChina Azure
The source files are as follows:
# Live ServiceClient URLs‘.blob.core.windows.net‘‘.queue.core.windows.net‘‘.table.core.windows.net‘‘.servicebus.windows.net‘‘management.core.windows.net‘
Modified to:
# Live ServiceClient URLs‘.blob.core.chinacloudapi.cn‘‘.queue.core.chinacloudapi.cn‘‘.table.core.chinacloudapi.cn‘‘.servicebus.chinacloudapi.cn‘‘management.core.chinacloudapi.cn‘
Start and stop a virtual machine
fromimport‘xxxxxxxx‘# 订阅ID‘xxxxxxxx‘# pem 证书路径sms = ServiceManagementService(subscription_id, certificate_path)sms.shutdown_role(‘orange‘‘oranged‘‘oranged‘, post_shutdown_action=‘Stopped‘)sms.start_role(‘xxx‘‘xxx‘‘xxx‘)
Linux
、
Mac
Command line Generation
azure
Certificate
365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pemopenssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer
Once the certificate is uploaded cer
to the console certificate management, it can be manipulated in the code azure
.
Python Operation Azure Virtual machine