スターターテンプレート

このセクションには、Azure Deploymentsコネクタで使用できるARMテンプレートの完全なセットが含まれています。これらのテンプレートはそのまま使用することも、特定のニーズに合わせて変更することもできます。

これらのテンプレートによって作成される各リソースには、同じタグセットが付けられます。これらのタグには、タスクを開始したユーザーの名前や入力したコメントなど、デプロイのコンテキストに関する有用な情報が含まれています。

これらのテンプレートは、コネクタ構成内のカスタムデータを広範囲に利用します。カスタムデータを使用すると、ユーザーはテンプレートを変更することなく、locationvmSizegenerationなどの共通パラメータやその他のパラメータを定義できます。

次の表に、これらのテンプレートで使用されるすべてのカスタムデータプロパティを示します。各プロパティがどのテンプレートに適用されるか、およびそのプロパティが必要かどうかを指定します。

R = 必須、O = オプション、- = 未使用

名前 タイプ 説明 デフォルト キャッシュディスク ブートイメージ マシン レイヤードイメージ
location string リソースが作成されるリージョン。 ターゲットリソースグループと同じリージョン。 O O O O
gallery string イメージを作成するコンピューティングギャラリーの名前。ギャラリーはターゲットリソースグループ内にある必要があります。 - - R - R
storageSku string マネージドディスクに使用するSKUの名前。 “StandardSSD_LRS” O - O -
NVMe boolean NVMeディスクコントローラを使用する場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false O O O O
generation string 仮想マシンの世代。 “V2” - O O O
trustedLaunch boolean Trusted Launchを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false O O O O
diskAccessId string ディスクコンテンツのアップロード時に使用されるディスクアクセスのリソースID。これが指定されている場合、ディスクはパブリックネットワークアクセスが無効な状態で作成されます。詳細については、Azureドキュメントを参照してください。 null O - - -
vmSize string 作成するVMのサイズ。 “Standard_D2s_v3” - - O -
prefix string マシンデプロイによって作成されるリソースの名前に付加するプレフィックス。 “al-“ - - O -
licenseType string 作成された仮想マシンに適用するオンプレミスライセンスタイプ。 null - - O -
subnetId string VMのネットワークカードを接続するサブネットのリソースID。 - - - R -
acceleratedNetworking boolean アクセラレーテッドネットワークを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false O O O O
replicaCount number ギャラリーイメージバージョンのリージョンごとのデフォルトレプリカ数。 1 - - - O
imageStorageAccountType string イメージの保存に使用するストレージアカウントタイプを指定します。 “Standard_LRS” - - - O
targetRegions array ギャラリーイメージバージョンのターゲットリージョン。これは、リージョン名文字列および/またはTargetRegionオブジェクトの配列として指定されます。配列には、ソースディスクのリージョン(locationカスタムデータで指定)が含まれている必要があります。 locationカスタムデータで指定されたリージョン - - - O
publishAs string or array イメージを公開するリソースのタイプ。’galleryImage’および/または’managedDisk’で構成される配列または文字列として指定されます。 [“galleryImage”] - - - O
diskNameFormat string マネージドディスクとして公開されるイメージの名前を制御します。”version”はイメージ名にバージョンを追加し、”timestamp”は公開時刻を追加します。 “version” - - - O

カスタムデータの例:

{
    "gallery": "MyGallery",
    "subnetId": "/subscriptions/ab3d1259-f5a9-407f-bbdd-bfd5701e2e94/resourceGroups/PDGTPB/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/mysubnet"
}
<!--NeedCopy-->

カスタムデータの別の例:

{
    "location": "eastus",
    "gallery": "MyGallery",
    "storageSku": "Premium_LRS",
    "trustedLaunch": true,
    "diskAccessId": "/subscriptions/ab3d1259-f5a9-407f-bbdd-bfd5701e2e94/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/diskAccesses/MyDiskAccess",
    "vmSize": "Standard_D4s_v3",
    "subnetId": "/subscriptions/ab3d1259-f5a9-407f-bbdd-bfd5701e2e94/resourceGroups/MyResourceGroup/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/mysubnet",
    "replicaCount": 2,
    "targetRegions": [
        "eastus",
        {
            "name": "eastus2",
            "regionalReplicaCount": 5,
            "storageAccountType": "Premium_LRS"
        },
        "westus"
    ]
}
<!--NeedCopy-->

キャッシュディスク

マネージドディスクを作成します。

キャッシュディスクのカスタムデータ

名前 タイプ 説明 デフォルト 必須
location string リソースが作成されるリージョン。 ターゲットリソースグループと同じリージョン no
storageSku string 使用するSKUの名前。 “StandardSSD_LRS” no
NVMe boolean NVMeディスクコントローラを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false no
acceleratedNetworking boolean アクセラレーテッドネットワークを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false no
trustedLaunch boolean Trusted Launchを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false no
diskAccessId string ディスクコンテンツのアップロード時に使用するディスクアクセスのリソースID。指定されている場合、ディスクはパブリックネットワークアクセスが無効な状態で作成されます。 null no

キャッシュディスクテンプレート

  • 1.2.0.0 - アクセラレーテッドネットワークとNVMeディスクコントローラをサポート
  • 1.1.0.0 - Trusted Launchをサポート
  • 1.0.0.0 - 初期バージョン
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.2.0.0",
    "parameters": {
        "al": {
            "type": "object"
        }
    },
    "variables": {
        "custom": "[parameters('al').context.config.custom]",
        "location": "[if(contains(variables('custom'), 'location'), variables('custom').location, resourceGroup().location)]",
        "name": "[concat(parameters('al').context.item.name,'-', parameters('al').context.item.id)]",
        "tags": {
            "alTaskId": "[parameters('al').context.taskId]",
            "alUser": "[parameters('al').context.user]",
            "alComment": "[parameters('al').context.comment]",
            "alItemType": "[parameters('al').context.item.type]",
            "alItemId": "[parameters('al').context.item.id]",
            "alItemName": "[parameters('al').context.item.name]",
            "alItemVersion": "[parameters('al').context.item.version.name]",
            "alConfigId": "[parameters('al').context.config.id]",
            "alConfigName": "[parameters('al').context.config.name]"
        },
        "hasDiskAccess": "[contains(variables('custom'), 'diskAccessId')]",
        "storageSku": "[if(contains(variables('custom'), 'storageSku'), variables('custom').storageSku, 'StandardSSD_LRS')]",
        "trustedLaunch": "[if(contains(variables('custom'), 'trustedLaunch'), variables('custom').trustedLaunch, false())]",
        "acceleratedNetworking": "[if(contains(variables('custom'), 'acceleratedNetworking'), variables('custom').acceleratedNetworking, false())]",
        "NVMe": "[if(contains(variables('custom'), 'NVMe'), variables('custom').NVMe, false())]"
    },
    "resources": [
        {
            "type": "Microsoft.Compute/disks",
            "apiVersion": "2024-03-02",
            "name": "[variables('name')]",
            "location": "[variables('location')]",
            "tags": "[variables('tags')]",
            "sku": {
                "name": "[variables('storageSku')]"
            },
            "properties": {
                "creationData": {
                    "createOption": "Upload",
                    "uploadSizeBytes": "[parameters('al').input.uploadSize]"
                },
                "incremental": "false",
                "diskAccessId": "[if(variables('hasDiskAccess'), variables('custom').diskAccessId, null())]",
                "networkAccessPolicy": "[if(variables('hasDiskAccess'), 'AllowPrivate', 'AllowAll')]",
                "publicNetworkAccess": "[if(variables('hasDiskAccess'), 'Disabled', 'Enabled')]",
                "securityProfile": "[if(variables('trustedLaunch'), createObject('securityType', 'TrustedLaunch'), null())]",
                "supportedCapabilities": {
                    "diskControllerTypes": "[if(variables('NVMe'), 'NVMe, SCSI', 'SCSI')]",
                    "acceleratedNetwork": "[variables('acceleratedNetworking')]"
                }
            }
        }
    ]
}
<!--NeedCopy-->

ブートイメージ

ブートイメージのデプロイは、カスタムデータで指定されたギャラリーにギャラリーイメージとイメージバージョンを作成します。作成されたコンピューティングギャラリーイメージバージョンのIDをマシンテンプレートで使用するために出力します。

ブートイメージのカスタムデータ

名前 タイプ 説明 デフォルト 必須
location string リソースが作成されるリージョン。 ターゲットリソースグループと同じリージョン。 no
generation string ディスクで使用される仮想マシンの世代。 “V2” no
NVMe boolean NVMeディスクコントローラを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false no
acceleratedNetworking boolean アクセラレーテッドネットワークを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false no
trustedLaunch boolean Trusted Launchを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false no
gallery string イメージを作成するコンピューティングギャラリーの名前。ギャラリーはターゲットリソースグループ内にある必要があります。 - yes

ブートイメージテンプレート

  • 1.2.0.0 - アクセラレーテッドネットワークとNVMeディスクコントローラをサポート
  • 1.1.0.0 - Trusted Launchをサポート
  • 1.0.0.0 - 初期バージョン
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.2.0.0",
    "parameters": {
        "al": {
            "type": "object"
        }
    },
    "variables": {
        "custom": "[parameters('al').context.config.custom]",
        "location": "[if(contains(variables('custom'), 'location'), variables('custom').location, resourceGroup().location)]",
        "tags": {
            "alTaskId": "[parameters('al').context.taskId]",
            "alUser": "[parameters('al').context.user]",
            "alComment": "[parameters('al').context.comment]",
            "alItemType": "[parameters('al').context.item.type]",
            "alItemId": "[parameters('al').context.item.id]",
            "alItemName": "[parameters('al').context.item.name]",
            "alItemVersion": "[parameters('al').context.item.version.name]",
            "alConfigId": "[parameters('al').context.config.id]",
            "alConfigName": "[parameters('al').context.config.name]"
        },
        "name": "[concat(parameters('al').context.item.name, '.', replace(parameters('al').context.config.id, '-', ''), '.', parameters('al').context.item.id)]",
        "version": "[parameters('al').context.item.version.name]",
        "galleryName": "[variables('custom').gallery]",
        "generation": "[if(contains(variables('custom'), 'generation'), variables('custom').generation, 'V2')]",
        "acceleratedNetworking": "[if(contains(variables('custom'), 'acceleratedNetworking'), variables('custom').acceleratedNetworking, false())]",
        "NVMe": "[if(contains(variables('custom'), 'NVMe'), variables('custom').NVMe, false())]",
        "trustedLaunch": "[if(contains(variables('custom'), 'trustedLaunch'), variables('custom').trustedLaunch, false())]",
        "possibleFeatures": [
            {
                "include": "[variables('trustedLaunch')]",
                "feature": {
                    "name": "SecurityType",
                    "value": "TrustedLaunch"
                }
            },
            {
                "include": "[variables('acceleratedNetworking')]",
                "feature": {
                    "name": "IsAcceleratedNetworkSupported",
                    "value": "True"
                }
            },
            {
                "include": "[variables('NVMe')]",
                "feature": {
                    "name": "DiskControllerTypes",
                    "value": "NVMe, SCSI"
                }
            }
        ]
    },
    "resources": [
        {
            "type": "Microsoft.Compute/galleries/images",
            "name": "[concat(variables('galleryName'), '/', variables('name'))]",
            "apiVersion": "2021-07-01",
            "location": "[variables('location')]",
            "tags": "[variables('tags')]",
            "properties": {
                "description": "[parameters('al').context.item.description]",
                "features": "[map(filter(variables('possibleFeatures'), lambda('x', lambdaVariables('x').include)), lambda('x', lambdaVariables('x').feature))]",
                "hyperVGeneration": "[variables('generation')]",
                "osType": "Windows",
                "osState": "Specialized",
                "endOfLifeDate": "2030-01-01T00:00:00Z",
                "identifier": {
                    "publisher": "Citrix",
                    "offer": "[parameters('al').context.config.id]",
                    "sku": "[parameters('al').context.item.id]"
                }
            },
            "resources": [
                {
                    "type": "versions",
                    "apiVersion": "2021-07-01",
                    "name": "[variables('version')]",
                    "location": "[variables('location')]",
                    "dependsOn": [
                        "[resourceId('Microsoft.Compute/galleries/images', variables('galleryName'), variables('name'))]"
                    ],
                    "tags": "[variables('tags')]",
                    "properties": {
                        "publishingProfile": {
                            "replicaCount": 1,
                            "targetRegions": [
                                {
                                    "name": "[variables('location')]"
                                }
                            ]
                        },
                        "storageProfile": {
                            "osDiskImage": {
                                "source": {
                                    "id": "[parameters('al').input.source.diskId]"
                                }
                            }
                        }
                    }
                }
            ]
        }
    ],
    "outputs": {
        "id": {
            "type": "string",
            "value": "[resourceId('Microsoft.Compute/galleries/images/versions', variables('galleryName'), variables('name'), variables('version'))]"
        }
    }
}
<!--NeedCopy-->

マシン

マシンのデプロイは、仮想マシン、NIC、およびマネージドディスクを作成します。このテンプレートは、ブートイメージのデプロイが指定されているかどうかにかかわらず機能します。

マシンのカスタムデータ

名前 タイプ 説明 デフォルト 必須
location string リソースが作成されるリージョン。 ターゲットリソースグループと同じリージョン。 no
storageSku string 作成されたディスクのSKUの名前。 “StandardSSD_LRS” no
generation string 仮想マシンの世代。 “V2” no
NVMe boolean NVMeディスクコントローラを使用する場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false no
acceleratedNetworking boolean アクセラレーテッドネットワークを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false no
trustedLaunch boolean Trusted Launchを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false no
secureBoot boolean セキュアブートを有効にする場合はtrue、それ以外の場合はfalse。これはtrustedLaunchtrueに設定されている場合にのみ適用されます。 true no
vTpm boolean vTPMを有効にする場合はtrue、それ以外の場合はfalse。これはtrustedLaunchtrueに設定されている場合にのみ適用されます。 true no
vmSize string 作成するVMのサイズ。 “Standard_D2s_v3” no
licenseType string 仮想マシンに適用するオンプレミスライセンスタイプ。 null no
subnetId string NICを接続するサブネットのリソースID。 - yes
prefix string 作成されたリソースの名前に付加するプレフィックス。 “al-“ no

マシンテンプレート

  • 1.2.0.0
    • アクセラレーテッドネットワークをサポート
    • NVMeディスクコントローラをサポート
    • IPSエクスポートをサポート
    • リソース名に付加されるプレフィックスをカスタマイズする機能を追加
    • App Layeringサブタスクに表示されるメッセージにIPアドレスを追加
    • OSディスクへのネットワークアクセスを無効化
  • 1.1.0.0 - Trusted Launchをサポート
  • 1.0.0.0 - 初期バージョン
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.2.0.0",
    "parameters": {
        "al": {
            "type": "object"
        }
    },
    "variables": {
        "custom": "[parameters('al').context.config.custom]",
        "location": "[if(contains(variables('custom'), 'location'), variables('custom').location, resourceGroup().location)]",
        "prefix": "[if(contains(variables('custom'), 'prefix'), variables('custom').prefix, 'al-')]",
        "name": "[concat(variables('prefix'), parameters('al').context.taskId)]",
        "vmName": "[concat(variables('name'), '-vm')]",
        "nicName": "[concat(variables('name'), '-nic')]",
        "diskName": "[concat(variables('name'), '-disk')]",
        "diskId": "[resourceId('Microsoft.Compute/disks', variables('diskName'))]",
        "tags": {
            "alTaskId": "[parameters('al').context.taskId]",
            "alUser": "[parameters('al').context.user]",
            "alComment": "[parameters('al').context.comment]",
            "alItemType": "[parameters('al').context.item.type]",
            "alItemId": "[parameters('al').context.item.id]",
            "alItemName": "[parameters('al').context.item.name]",
            "alItemVersion": "[parameters('al').context.item.version.name]",
            "alConfigId": "[parameters('al').context.config.id]",
            "alConfigName": "[parameters('al').context.config.name]"
        },
        "source": "[parameters('al').input.disk.image]",
        "isFromImage": "[not(contains(variables('source'), 'diskId'))]",
        "generation": "[if(contains(variables('custom'), 'generation'), variables('custom').generation, 'V2')]",
        "vmSize": "[if(contains(variables('custom'), 'vmSize'), variables('custom').vmSize, 'Standard_D2s_v3')]",
        "storageSku": "[if(contains(variables('custom'), 'storageSku'), variables('custom').storageSku, 'StandardSSD_LRS')]",
        "trustedLaunch": "[if(contains(variables('custom'), 'trustedLaunch'), variables('custom').trustedLaunch, false())]",
        "secureBoot": "[if(contains(variables('custom'), 'secureBoot'), variables('custom').secureBoot, variables('trustedLaunch'))]",
        "vTpm": "[if(contains(variables('custom'), 'vTpm'), variables('custom').vTpm, variables('trustedLaunch'))]",
        "acceleratedNetworking": "[if(contains(variables('custom'), 'acceleratedNetworking'), variables('custom').acceleratedNetworking, false())]",
        "NVMe": "[if(contains(variables('custom'), 'NVMe'), variables('custom').NVMe, false())]",
        "securityProfile": {
            "securityType": "TrustedLaunch",
            "uefiSettings": {
                "secureBootEnabled": "[variables('secureBoot')]",
                "vTpmEnabled": "[variables('vTpm')]"
            }
        },
        "dataDiskTemplate": {
            "createOption": "Attach",
            "deleteOption": "Delete",
            "managedDisk": {
                "id": "ToBeReplaced"
            }
        },
        "dataDiskName": "[concat(variables('name'), '-disk{0}')]",
        "additionalDisks": "[if(contains(parameters('al').input, 'additionalDisks'), parameters('al').input.additionalDisks, createArray())]",     
        "additionalDiskIds": "[map(variables('additionalDisks'), lambda('x', lambdaVariables('x').diskId))]",
        "dataDiskIds": "[map(variables('additionalDiskIds'), lambda('x', 'i', resourceId('Microsoft.Compute/disks',format(variables('dataDiskName'), lambdaVariables('i')))))]"
    
    },
    "resources": [
        {
            "type": "Microsoft.Network/networkInterfaces",
            "apiVersion": "2020-11-01",
            "name": "[variables('nicName')]",
            "location": "[variables('location')]",
            "tags": "[variables('tags')]",
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig1",
                        "properties": {
                            "privateIPAllocationMethod": "Dynamic",
                            "subnet": {
                                "id": "[variables('custom').subnetId]"
                            },
                            "primary": true,
                            "privateIPAddressVersion": "IPv4"
                        }
                    }
                ],
                "dnsSettings": {
                    "dnsServers": []
                },
                "enableAcceleratedNetworking": "[variables('acceleratedNetworking')]",
                "enableIPForwarding": false
            }
        },
        {
            "condition": "[not(variables('isFromImage'))]",
            "type": "Microsoft.Compute/disks",
            "apiVersion": "2021-08-01",
            "name": "[variables('diskName')]",
            "location": "[variables('location')]",
            "tags": "[variables('tags')]",
            "sku": {
                "name": "[variables('storageSku')]"
            },
            "properties": {
                "osType": "Windows",
                "hyperVGeneration": "[variables('generation')]",
                "creationData": {
                    "createOption": "Copy",
                    "sourceResourceId": "[variables('source').diskId]"
                },
                "diskSizeGB": "[parameters('al').input.disk.size]",
                "networkAccessPolicy": "DenyAll",
                "publicNetworkAccess": "Disabled",
                "supportedCapabilities": {
                    "acceleratedNetwork": "[variables('acceleratedNetworking')]"
                }
            }
        },
        {
            "copy": {
                "name": "data-disk-loop",
                "count": "[length(variables('additionalDiskIds'))]",
                "mode": "Parallel"
            },
            "type": "Microsoft.Compute/disks",
            "apiVersion": "2021-08-01",
            "name": "[format(variables('dataDiskName'), copyIndex())]",
            "location": "[variables('location')]",
            "tags": "[variables('tags')]",
            "sku": {
                "name": "[variables('storageSku')]"
            },
            "properties": {
                "creationData": {
                    "createOption": "Copy",
                    "sourceResourceId": "[variables('additionalDiskIds')[copyIndex()]]"
                },
                "networkAccessPolicy": "DenyAll",
                "publicNetworkAccess": "Disabled"
            }
        },
        {
            "type": "Microsoft.Compute/virtualMachines",
            "apiVersion": "2022-08-01",
            "name": "[variables('vmName')]",
            "location": "[variables('location')]",
            "dependsOn": [
                "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]",
                "[variables('diskId')]",
                "data-disk-loop"
            ],
            "tags": "[variables('tags')]",
            "properties": {
                "hardwareProfile": {
                    "vmSize": "[variables('vmSize')]"
                },
                "securityProfile": "[if(variables('trustedLaunch'), variables('securityProfile'), null())]",
                "storageProfile": {
                    "imageReference": "[if(variables('isFromImage'), createObject('id', variables('source').id), null())]",
                    "diskControllerType": "[if(variables('NVMe'), 'NVMe', null())]",
                    "osDisk": {
                        "osType": "Windows",
                        "createOption": "[if(variables('isFromImage'), 'FromImage', 'Attach')]",
                        "caching": "ReadWrite",
                        "deleteOption": "Delete",
                        "diskSizeGB": "[parameters('al').input.disk.size]",
                        "managedDisk": "[if(variables('isFromImage'), createObject('storageAccountType', variables('storageSku')), createObject('id', variables('diskId')))]"
                    },
                    "dataDisks": "[map(variables('dataDiskIds'), lambda('x', 'i', union(variables('dataDiskTemplate'), createObject('lun', lambdaVariables('i'), 'managedDisk', createObject('id', lambdaVariables('x'))))))]"
                },
                "networkProfile": {
                    "networkInterfaces": [
                        {
                            "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
                        }
                    ]
                },
                "diagnosticsProfile": {
                    "bootDiagnostics": {
                        "enabled": true
                    }
                },
                "licenseType": "[if(contains(variables('custom'), 'licenseType'), variables('custom').licenseType, null())]",
                "userData": "[parameters('al').input.vm.userData]"
            }
        }
    ],
    "outputs": {
        "diskId": {
            "type": "string",
            "value": "[reference(variables('vmName')).storageProfile.osDisk.managedDisk.id]"
        },
        "message": {
            "type": "string",
            "value": "[format('See [link=\"{0}/#@{1}/resource/{2}\"]{2}[/link]. IP Address: {3}', environment().portal, tenant().tenantId, resourceId('Microsoft.Compute/virtualMachines', variables('vmName')), reference(variables('nicName')).ipConfigurations[0].properties.privateIPAddress)]"
        }
    }
}
<!--NeedCopy-->

レイヤードイメージ

レイヤードイメージのデプロイは、ギャラリーイメージバージョンおよび/またはマネージドディスクの2種類のリソースを作成できます。両方のリソースタイプは、公開されるApp Layeringイメージテンプレートの名前とその構築されたバージョン番号を使用して命名されます。バージョン番号は、App Layeringイメージテンプレートのディスク名からメジャー番号とマイナー番号を使用して構築されます。ディスク名が数値バージョン(number.number)としてフォーマットされていない場合、デフォルトで1.0が適用されます。パッチ番号は、App Layeringイメージテンプレートのバージョン番号(公開された回数)です。ギャラリーイメージには名前が割り当てられ、ギャラリーイメージバージョンにはバージョン番号が割り当てられます。マネージドディスクには、diskNameFormatに応じて、バージョン番号または現在のタイムスタンプが付加された名前が割り当てられます。

ギャラリーイメージとバージョンは、カスタムデータで指定されたギャラリーに作成されます。イメージが複数回公開されると、新しいバージョンがコンピューティングギャラリーイメージに追加され、古いバージョンは残ります。

レイヤードイメージのカスタムデータ

R = 必須、O = オプション、- = 未使用

名前 タイプ 説明 デフォルト ギャラリーイメージ マネージドディスク
publishAs string or array 作成するリソースのタイプ。’galleryImage’および/または’managedDisk’で構成される配列または文字列として指定されます。 [“galleryImage”] O R
location string リソースが作成されるリージョン。 ターゲットリソースグループと同じリージョン O O
generation string イメージがサポートする仮想マシンの世代。 “V2” O O
NVMe boolean NVMeディスクコントローラを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false O O
acceleratedNetworking boolean アクセラレーテッドネットワークを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false O O
trustedLaunch boolean Trusted Launchを有効にする場合はtrue、それ以外の場合はfalse。これはすべてのデプロイタイプで同じ値である必要があります。 false O O
gallery string イメージを作成するコンピューティングギャラリーの名前。ギャラリーはターゲットリソースグループ内にある必要があります。 - R -
replicaCount number ギャラリーイメージバージョンのリージョンごとのデフォルトレプリカ数。 1 O -
imageStorageAccountType string イメージの保存に使用するストレージアカウントタイプを指定します。 “Standard_LRS” O -
targetRegions array ギャラリーイメージバージョンのターゲットリージョン。これは、リージョン名文字列および/またはTargetRegionオブジェクトの配列として指定されます。配列には、ソースディスクのリージョン(locationカスタムデータで指定)が含まれている必要があります。 locationカスタムデータで指定されたリージョン O -
storageSku string 使用するSKUの名前。 “StandardSSD_LRS” - O
diskAccessId string ディスクコンテンツのアップロード時に使用するディスクアクセスのリソースID。指定されている場合、ディスクはパブリックネットワークアクセスが無効な状態で作成されます。 null - O
diskNameFormat string マネージドディスクとして公開されるイメージの名前を制御します。”version”はイメージ名にバージョンを追加し、”timestamp”は公開時刻を追加します。 “version” - O

レイヤードイメージテンプレート

  • 1.2.0.0
    • アクセラレーテッドネットワークをサポート
    • NVMeディスクコントローラをサポート
    • ギャラリーイメージバージョンのストレージアカウントタイプを指定する機能を追加
    • イメージバージョンではなく公開時刻を使用してマネージドディスクに名前を付ける選択肢を追加(レガシー命名に類似)
    • ギャラリーイメージバージョンとして公開しない場合でもgalleryNameが必須となるバグを修正
  • 1.1.0.0
    • Trusted Launchをサポート
    • ギャラリーイメージバージョンのレプリカ数とターゲットリージョンをサポート
    • マネージドディスクとしての公開をサポート
  • 1.0.0.0 - 初期バージョン
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.2.0.0",
    "parameters": {
        "al": {
            "type": "object"
        },
        "timestamp": {
            "type": "string",
            "defaultValue": "[utcNow('yyyy-MM-dd_HH-mm-ss')]"
        }
    },
    "variables": {
        "invalidChars": [ " ", "(", ")", "[[", "]", "{", "}", "!", "@", "#", "$", "%", "^", "&", "*", "+", "/", "\\", "'", "\"", "|", "`", "~", "<", ">", ",", "?", "*" ],
        "numericChars": [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ],
        "custom": "[parameters('al').context.config.custom]",
        "location": "[if(contains(variables('custom'), 'location'), variables('custom').location, resourceGroup().location)]",
        "name": "[join(split(parameters('al').context.item.name, variables('invalidChars')), '_')]",
        "tags": {
            "alTaskId": "[parameters('al').context.taskId]",
            "alUser": "[parameters('al').context.user]",
            "alComment": "[parameters('al').context.comment]",
            "alItemType": "[parameters('al').context.item.type]",
            "alItemId": "[parameters('al').context.item.id]",
            "alItemName": "[parameters('al').context.item.name]",
            "alItemVersion": "[parameters('al').context.item.version.name]",
            "alConfigId": "[parameters('al').context.config.id]",
            "alConfigName": "[parameters('al').context.config.name]"
        },
        "splitVer": "[split(parameters('al').input.diskName, '.')]",
        "major": "[if(equals(0, length(join(split(variables('splitVer')[0], variables('numericChars')), ''))), variables('splitVer')[0], '1')]",
        "minor": "[if(greater(length(variables('splitVer')), 1), if(equals(0, length(join(split(variables('splitVer')[1], variables('numericChars')), ''))), variables('splitVer')[1], '0'), '0')]",
        "version": "[format('{0}.{1}.{2}', variables('major'), variables('minor'), parameters('al').context.item.version.number)]",
        "galleryName": "[if(contains(variables('custom'), 'gallery'), variables('custom').gallery, 'galleryName.required.in.custom.data')]",
        "generation": "[if(contains(variables('custom'), 'generation'), variables('custom').generation, 'V2')]",
        "trustedLaunch": "[if(contains(variables('custom'), 'trustedLaunch'), variables('custom').trustedLaunch, false())]",
        "acceleratedNetworking": "[if(contains(variables('custom'), 'acceleratedNetworking'), variables('custom').acceleratedNetworking, false())]",
        "NVMe": "[if(contains(variables('custom'), 'NVMe'), variables('custom').NVMe, false())]",
        "replicaCount": "[if(contains(variables('custom'), 'replicaCount'), variables('custom').replicaCount, 1)]",
        "targetRegions": "[if(contains(variables('custom'), 'targetRegions'), variables('custom').targetRegions, createArray(variables('location')))]",
        "diskNames": {
            "version": "[format('{0}_{1}-{2}-{3}', variables('name'), variables('major'), variables('minor'), parameters('al').context.item.version.number)]",
            "timestamp": "[format('{0}_{1}', variables('name'), parameters('timestamp'))]"
        },
        "diskName": "[variables('diskNames')[coalesce(tryGet(variables('custom'), 'diskNameFormat'), 'version')]]",
        "hasDiskAccess": "[contains(variables('custom'), 'diskAccessId')]",
        "storageSku": "[if(contains(variables('custom'), 'storageSku'), variables('custom').storageSku, 'StandardSSD_LRS')]",
        "imageStorageAccountType": "[coalesce(tryGet(variables('custom'), 'imageStorageAccountType'), 'Standard_LRS')]",
        "publishAs": "[if(contains(variables('custom'), 'publishAs'), variables('custom').publishAs, createArray('galleryImage'))]",
        "galleryLink": "[format('[link=\"{0}/#@{1}/resource/{2}\"]{2}[/link].', environment().portal, tenant().tenantId, resourceId('Microsoft.Compute/galleries/images/versions', variables('galleryName'), variables('name'), variables('version')))]",
        "diskLink": "[format('[link=\"{0}/#@{1}/resource/{2}\"]{2}[/link].', environment().portal, tenant().tenantId, resourceId('Microsoft.Compute/disks', variables('diskName')))]",
        "outputLinks": "[filter(createArray(if(contains(variables('publishAs'), 'galleryImage'), variables('galleryLink'), null()), if(contains(variables('publishAs'), 'managedDisk'), variables('diskLink'), null())), lambda('link', not(equals(lambdaVariables('link'), null()))))]",
        "possibleFeatures": [
            {
                "include": "[variables('trustedLaunch')]",
                "feature": {
                    "name": "SecurityType",
                    "value": "TrustedLaunch"
                }
            },
            {
                "include": "[variables('acceleratedNetworking')]",
                "feature": {
                    "name": "IsAcceleratedNetworkSupported",
                    "value": "True"
                }
            },
            {
                "include": "[variables('NVMe')]",
                "feature": {
                    "name": "DiskControllerTypes",
                    "value": "NVMe, SCSI"
                }
            }
        ]
    },
    "resources": [
        {
            "condition": "[contains(variables('publishAs'), 'galleryImage')]",
            "type": "Microsoft.Compute/galleries/images",
            "name": "[format('{0}/{1}', variables('galleryName'), variables('name'))]",
            "apiVersion": "2021-07-01",
            "location": "[variables('location')]",
            "properties": {
                "description": "[parameters('al').context.item.description]",
                "features": "[map(filter(variables('possibleFeatures'), lambda('x', lambdaVariables('x').include)), lambda('x', lambdaVariables('x').feature))]",
                "hyperVGeneration": "[variables('generation')]",
                "osType": "Windows",
                "osState": "Specialized",
                "endOfLifeDate": "2030-01-01T00:00:00Z",
                "identifier": {
                    "publisher": "AppLayering",
                    "offer": "[variables('name')]",
                    "sku": "[variables('generation')]"
                }
            },
            "tags": "[variables('tags')]",
            "resources": [
                {
                    "condition": "[contains(variables('publishAs'), 'galleryImage')]",
                    "type": "versions",
                    "apiVersion": "2022-03-03",
                    "name": "[variables('version')]",
                    "location": "[variables('location')]",
                    "dependsOn": [
                        "[resourceId('Microsoft.Compute/galleries/images', variables('galleryName'), variables('name'))]"
                    ],
                    "tags": "[variables('tags')]",
                    "properties": {
                        "publishingProfile": {
                            "replicaCount": "[variables('replicaCount')]",
                            "storageAccountType": "[variables('imageStorageAccountType')]",
                            "targetRegions": "[map(variables('targetRegions'), lambda('item', if(contains(lambdaVariables('item'), 'name'), lambdaVariables('item'), createObject('name', lambdaVariables('item')))))]"
                        },
                        "storageProfile": {
                            "osDiskImage": {
                                "source": {
                                    "id": "[parameters('al').input.source.diskId]"
                                }
                            }
                        }
                    }
                }
            ]
        },
        {
            "condition": "[contains(variables('publishAs'), 'managedDisk')]",
            "type": "Microsoft.Compute/disks",
            "apiVersion": "2021-08-01",
            "name": "[variables('diskName')]",
            "location": "[variables('location')]",
            "tags": "[variables('tags')]",
            "sku": {
                "name": "[variables('storageSku')]"
            },
            "properties": {
                "osType": "Windows",
                "hyperVGeneration": "[variables('generation')]",
                "creationData": {
                    "createOption": "Copy",
                    "sourceResourceId": "[parameters('al').input.source.diskId]"
                },
                "diskAccessId": "[if(variables('hasDiskAccess'), variables('custom').diskAccessId, null())]",
                "networkAccessPolicy": "[if(variables('hasDiskAccess'), 'AllowPrivate', 'AllowAll')]",
                "publicNetworkAccess": "[if(variables('hasDiskAccess'), 'Disabled', 'Enabled')]"
            }
        }
    ],
    "outputs": {
        "message": {
            "type": "string",
            "value": "[if(empty(variables('outputLinks')), null(), format('See {0}.', join(variables('outputLinks'), ' and ')))]"
        }
    }
}
<!--NeedCopy-->
スターターテンプレート