クラウド管理者は、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)}