Azure 虛擬機器程式庫
概觀
執行 Linux 或 Windows 並可視需要擴充的計算資源。
若要開始使用 Azure 虛擬機器,請參閱使用 Azure 入口網站建立 Linux 虛擬機器。
管理 API
從程式碼使用管理 API 在 Azure 中建立、設定、管理及調整 Windows 和 Linux 虛擬機器。
透過 pip 安裝程式庫。
pip install azure-mgmt-compute
範例
在現有的 Azure 資源群組中,使用受控服務身分識別 (MSI) 驗證建立新的 Linux 虛擬機器。
VM_PARAMETERS={
'location': 'LOCATION',
'os_profile': {
'computer_name': 'VM_NAME',
'admin_username': 'USERNAME',
'admin_password': 'PASSWORD'
},
'hardware_profile': {
'vm_size': 'Standard_DS1_v2'
},
'storage_profile': {
'image_reference': {
'publisher': 'Canonical',
'offer': 'UbuntuServer',
'sku': '16.04.0-LTS',
'version': 'latest'
},
},
'network_profile': {
'network_interfaces': [{
'id': 'NIC_ID',
}]
},
}
def create_vm()
compute_client.virtual_machines.create_or_update(
'RESOURCE_GROUP_NAME', 'VM_NAME', VM_PARAMETERS)
範例
檢視虛擬機器範本的完整清單。
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應