身為雲端管理員,您可以在建置基礎結構時利用 Microsoft Azure 外掛程式佈建以外掛程式為基礎的虛擬機器。此外,還可以使用配置協助程式為虛擬機器提供配置邏輯。
可以使用最新的 Azure 内容輕鬆設定虛擬機器以支援您的基礎結構需求。例如,如果要為虛擬機器啟用開機診斷,可以在雲端範本中使用 boot_diagnostics
內容。
- 啟動
- 關閉電源
- 重新啟動
- 取消配置
若要進一步瞭解 VMware Aria Automation 中的外掛程式和配置,請參閱〈Automation Assembler 中以外掛程式為基礎的設計和部署〉
虛擬機器內容
以外掛程式為基礎的 Azure 虛擬機器需要以下內容。
內容 | 說明 |
---|---|
name |
資源的外掛程式特定名稱。 可以對 |
virtual_machine_name |
Azure 入口網站中虛擬機器的名稱。 使用 Automation Assembler 部署的 Azure 資源必須符合 Azure 命名規則和限制。否則,部署將會失敗。如需詳細資訊,請參閱〈資源命名限制〉。 |
account |
您的團隊在其中部署雲端範本的帳戶區域的 Microsoft Azure 雲端帳戶。 如需詳細資訊,請參閱〈在 VMware Aria Automation 中建立 Microsoft Azure 雲端帳戶〉。 |
location |
將部署虛擬機器的區域。 |
resource_group_name |
資源群組的名稱。 必須在 Azure 入口網站中建立資源群組。 |
佈建具有資料磁碟的 Azure 虛擬機器
以下範本顯示了如何使用配置協助程式佈建虛擬機器。在此範例中,將建立已連結資料磁碟的虛擬機器。
在部署此範本之前,請完成以下步驟:
- 在 Automation Assembler 中建立 Microsoft Azure 雲端帳戶,建立專案,然後新增雲端區域。
- 透過 Azure 入口網站建立資源群組。
- 在 Azure 入口網站的資源群組中建立網路介面。網路介面必須位於將用於部署 Azure 虛擬機器的區域。
formatVersion: 1 inputs: UUID: type: string title: UUID resources: Allocations_Compute_1: type: Allocations.Compute properties: {} Allocations_Flavor_1: type: Allocations.Flavor properties: flavor: medium Allocations_Image_1: type: Allocations.Image properties: image: ubuntu Cloud_Azure_ResourceGroup_1: type: Cloud.Azure.ResourceGroup properties: name: e2e-a8n-RG-${input.UUID} useExisting: false Idem_NETWORK: type: Idem.AZURE.NETWORK.VIRTUAL_NETWORKS properties: name: e2e-a8n-idem-virtual-net-${input.UUID} account: ${resource.Allocations_Compute_1.selectedCloudAccount.name} location: ${resource.Allocations_Compute_1.selectedRegion.id} address_space: - 10.0.0.0/24 subnets: - name: ${resource.Idem_NETWORK.name} address_prefix: 10.0.0.0/24 resource_group_name: ${resource.Cloud_Azure_ResourceGroup_1.resourceName} virtual_network_name: ${resource.Idem_NETWORK.name} Idem_NETWORK_INTERFACE: type: Idem.AZURE.NETWORK.NETWORK_INTERFACES properties: name: e2e-a8n-idem-net-interface-${input.UUID} account: ${resource.Allocations_Compute_1.selectedCloudAccount.name} location: ${resource.Allocations_Compute_1.selectedRegion.id} ip_configurations: - primary: true name: ipconfig2 private_ip_address: 10.0.0.13 private_ip_address_allocation: Static private_ip_address_version: IPv4 subnet_id: ${'/subscriptions/' + resource.Idem_NETWORK.subscription_id + '/resourceGroups/' + resource.Idem_NETWORK.resource_group_name + '/providers/Microsoft.Network/virtualNetworks/' + resource.Idem_NETWORK.name + '/subnets/' + resource.Idem_NETWORK.subnets[0].name} resource_group_name: ${resource.Idem_NETWORK.resource_group_name} network_interface_name: ${resource.Idem_NETWORK_INTERFACE.name} Idem_DATA_DISK: type: Idem.AZURE.COMPUTE.DISKS properties: name: e2e-a8n-idem-data-disk-${input.UUID} account: ${resource.Allocations_Compute_1.selectedCloudAccount.name} location: ${resource.Allocations_Compute_1.selectedRegion.id} resource_group_name: ${resource.Idem_NETWORK.resource_group_name} disk_name: ${resource.Idem_DATA_DISK.name} disk_size_gb: 10 creation_data: create_option: Empty encryption: disk_encryption_set_id: ${'/subscriptions/' + resource.Idem_NETWORK.subscription_id + '/resourceGroups/DND-static-RG-for-automation/providers/Microsoft.Compute/diskEncryptionSets/DND-e2e-a8n-disk-encryption'} type: EncryptionAtRestWithCustomerKey Idem_VM: type: Idem.AZURE.COMPUTE.VIRTUAL_MACHINES properties: name: e2e-a8n-idem-vm-${input.UUID} account: ${resource.Allocations_Compute_1.selectedCloudAccount.name} location: ${resource.Allocations_Compute_1.selectedRegion.id} resource_group_name: ${resource.Idem_NETWORK.resource_group_name} virtual_machine_name: ${resource.Idem_VM.name} network_interface_ids: - ${resource.Idem_NETWORK_INTERFACE.resource_id} os_profile: admin_username: my-admin-username computer_name: machine-name admin_password: admin virtual_machine_size: ${resource.Allocations_Flavor_1.selectedInstanceTypeName} storage_image_reference: image_sku: ${split(resource.Allocations_Image_1.selectedImageId, ':')[2]} image_publisher: ${split(resource.Allocations_Image_1.selectedImageId, ':')[0]} image_version: ${split(resource.Allocations_Image_1.selectedImageId, ':')[3]} image_offer: ${split(resource.Allocations_Image_1.selectedImageId, ':')[1]} storage_os_disk: storage_account_type: Standard_LRS disk_name: e2e-a8n-idem-os-disk-${input.UUID} disk_caching: ReadWrite disk_size_in_GB: 30 disk_create_option: FromImage disk_delete_option: Delete storage_data_disks: - disk_id: ${resource.Idem_DATA_DISK.resource_id} disk_logical_unit_number: 3 disk_create_option: Attach disk_delete_option: Delete disk_size_in_GB: 10 disk_name: ${resource.Idem_DATA_DISK.disk_name} Cloud_Service_Azure_SQL_Server_1: type: Cloud.Service.Azure.SQL.Server properties: name: e2e-a8n-db-server-puca-${input.UUID} region: ${resource.Allocations_Compute_1.selectedRegion.id} account: ${resource.Allocations_Compute_1.selectedCloudAccount.name} version: '' administrator_login: [email protected] resource_group_name: ${resource.Cloud_Azure_ResourceGroup_1.resourceName} administrator_login_password: admin Idem_AZURE_SQL_DATABASE_DATABASES_1: type: Idem.AZURE.SQL_DATABASE.DATABASES properties: name: e2e-a8n-idem-sql-db-${input.UUID} database_name: e2e-a8n-idem-sql-db-${input.UUID} server_name: ${resource.Cloud_Service_Azure_SQL_Server_1.name} account: ${resource.Allocations_Compute_1.selectedCloudAccount.name} location: ${resource.Allocations_Compute_1.selectedRegion.id} tags: tag-key: tag-value sku: name: GP_Gen5 tier: GeneralPurpose family: Gen5 capacity: 2 requested_backup_storage_redundancy: Local resource_group_name: ${resource.Idem_NETWORK.resource_group_name} read_scale: Disabled Idem_AZURE_STORAGE_RESOURCE_PROVIDER_STORAGE_ACCOUNTS_1: type: Idem.AZURE.STORAGE_RESOURCE_PROVIDER.STORAGE_ACCOUNTS dependsOn: - Idem_NETWORK properties: name: e2ea8nidemstacct${input.UUID} account: ${resource.Allocations_Compute_1.selectedCloudAccount.name} location: ${resource.Allocations_Compute_1.selectedRegion.id} sku_name: Standard_LRS account_name: e2ea8nidemstacct${input.UUID} resource_group_name: ${resource.Cloud_Azure_ResourceGroup_1.resourceName} identity: type: UserAssigned user_assigned_identities: /subscriptions/svpvln45-brk0-mzca-7yxh-dla7h19zxyn3/resourceGroups/DND-static-RG-for-automation/providers/Microsoft.ManagedIdentity/userAssignedIdentities/DND-user-assigned-managed-identity: {} encryption_service: encryption_key_source: Microsoft.Keyvault blob_encryption_key_type: Account file_encryption_key_type: Account customer_managed_key: key_name: DND-e2e-a8n-key key_vault_uri: https://dnd-e2e-a8n-key-vault.vault.azure.net/ key_version: '' user_assigned_identity_id: ${'/subscriptions/' + resource.Idem_NETWORK.subscription_id + '/resourceGroups/DND-static-RG-for-automation/providers/Microsoft.ManagedIdentity/userAssignedIdentities/DND-user-assigned-managed-identity'} immutability_policy: allow_protected_append_writes: true period_since_creation_in_days: 5 state: Unlocked
如果要將其他磁碟連結至虛擬機器,可以更新虛擬機器資源的藍圖,並在 storage_data_disks
內容中新增資料磁碟。
使用 cloud-init 佈建 Azure 虛擬機器
以下範本展示了如何使用 cloud-init 佈建 Azure 虛擬機器。
首先,在雲端範本中將 cloud-init 程式碼定義為輸入,並使用 custom_data
內容中的值。custom_data
內容僅接受 base64 編碼字串,因此您可以使用 base64_encoded
函數轉換自訂資料。
inputs: init-data: type: string default: | some multiline maxLength: 9999
resources: Idem_AZURE_COMPUTE_VIRTUAL_MACHINES_1: type: Idem.AZURE.COMPUTE.VIRTUAL_MACHINES properties: ... os_profile: ... custom_data: ${base64_encode(input.init-data)}