diff --git a/builder/azure/arm/TestVirtualMachineDeployment05.approved.txt b/builder/azure/arm/TestVirtualMachineDeployment05.approved.txt deleted file mode 100644 index 31532ddb..00000000 --- a/builder/azure/arm/TestVirtualMachineDeployment05.approved.txt +++ /dev/null @@ -1,118 +0,0 @@ -{ - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", - "contentVersion": "1.0.0.0", - "parameters": { - "adminPassword": { - "type": "string" - }, - "adminUsername": { - "type": "string" - }, - "dnsNameForPublicIP": { - "type": "string" - }, - "osDiskName": { - "type": "string" - }, - "storageAccountBlobEndpoint": { - "type": "string" - }, - "vmName": { - "type": "string" - }, - "vmSize": { - "type": "string" - } - }, - "resources": [ - { - "apiVersion": "[variables('apiVersion')]", - "dependsOn": [], - "location": "[variables('location')]", - "name": "[variables('nicName')]", - "properties": { - "ipConfigurations": [ - { - "name": "ipconfig", - "properties": { - "privateIPAllocationMethod": "Dynamic", - "subnet": { - "id": "[variables('subnetRef')]" - } - } - } - ] - }, - "type": "Microsoft.Network/networkInterfaces" - }, - { - "apiVersion": "[variables('apiVersion')]", - "dependsOn": [ - "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" - ], - "location": "[variables('location')]", - "name": "[parameters('vmName')]", - "properties": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": false - } - }, - "hardwareProfile": { - "vmSize": "[parameters('vmSize')]" - }, - "networkProfile": { - "networkInterfaces": [ - { - "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" - } - ] - }, - "osProfile": { - "adminPassword": "[parameters('adminPassword')]", - "adminUsername": "[parameters('adminUsername')]", - "computerName": "[parameters('vmName')]", - "linuxConfiguration": { - "ssh": { - "publicKeys": [ - { - "keyData": "", - "path": "[variables('sshKeyPath')]" - } - ] - } - } - }, - "storageProfile": { - "osDisk": { - "caching": "ReadWrite", - "createOption": "FromImage", - "image": { - "uri": "https://localhost/custom.vhd" - }, - "name": "[parameters('osDiskName')]", - "osType": "Linux", - "vhd": { - "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" - } - } - } - }, - "type": "Microsoft.Compute/virtualMachines" - } - ], - "variables": { - "addressPrefix": "10.0.0.0/16", - "apiVersion": "2015-06-15", - "location": "[resourceGroup().location]", - "publicIPAddressType": "Dynamic", - "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", - "subnetAddressPrefix": "10.0.0.0/24", - "subnetName": "ignore", - "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", - "virtualNetworkName": "ignore", - "virtualNetworkResourceGroup": "ignore", - "vmStorageAccountContainerName": "images", - "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" - } -} \ No newline at end of file diff --git a/builder/azure/arm/builder.go b/builder/azure/arm/builder.go index 61b61da7..ed7aadb6 100644 --- a/builder/azure/arm/builder.go +++ b/builder/azure/arm/builder.go @@ -488,12 +488,16 @@ func (b *Builder) configureStateBag(stateBag multistep.StateBag) { } stateBag.Put(constants.ArmKeyVaultName, b.config.tmpKeyVaultName) + stateBag.Put(constants.ArmKeyVaultSecretName, DefaultSecretName) stateBag.Put(constants.ArmIsExistingKeyVault, false) if b.config.BuildKeyVaultName != "" { stateBag.Put(constants.ArmKeyVaultName, b.config.BuildKeyVaultName) b.config.tmpKeyVaultName = b.config.BuildKeyVaultName stateBag.Put(constants.ArmIsExistingKeyVault, true) } + if b.config.BuildKeyVaultSecretName != "" { + stateBag.Put(constants.ArmKeyVaultSecretName, b.config.BuildKeyVaultSecretName) + } stateBag.Put(constants.ArmNicName, b.config.tmpNicName) stateBag.Put(constants.ArmPublicIPAddressName, b.config.tmpPublicIPAddressName) diff --git a/builder/azure/arm/config.go b/builder/azure/arm/config.go index d3009cc4..744520bc 100644 --- a/builder/azure/arm/config.go +++ b/builder/azure/arm/config.go @@ -363,9 +363,11 @@ type Config struct { TempResourceGroupName string `mapstructure:"temp_resource_group_name"` // Specify an existing resource group to run the build in. BuildResourceGroupName string `mapstructure:"build_resource_group_name"` - // Specify an existing key vault to use for uploading certificates to the + // Specify an existing key vault to use for uploading the certificate for the // instance to connect. BuildKeyVaultName string `mapstructure:"build_key_vault_name"` + // Specify the secret name to use for the certificate created in the key vault. + BuildKeyVaultSecretName string `mapstructure:"build_key_vault_secret_name"` // Specify the KeyVault SKU to create during the build. Valid values are // standard or premium. The default value is standard. BuildKeyVaultSKU string `mapstructure:"build_key_vault_sku"` @@ -1005,6 +1007,10 @@ func provideDefaultValues(c *Config) { c.BuildKeyVaultSKU = DefaultKeyVaultSKU } + if c.BuildKeyVaultSecretName == "" { + c.BuildKeyVaultSecretName = DefaultSecretName + } + _ = c.ClientConfig.SetDefaultValues() } diff --git a/builder/azure/arm/config.hcl2spec.go b/builder/azure/arm/config.hcl2spec.go index b576e440..dd734d7a 100644 --- a/builder/azure/arm/config.hcl2spec.go +++ b/builder/azure/arm/config.hcl2spec.go @@ -67,6 +67,7 @@ type FlatConfig struct { TempResourceGroupName *string `mapstructure:"temp_resource_group_name" cty:"temp_resource_group_name" hcl:"temp_resource_group_name"` BuildResourceGroupName *string `mapstructure:"build_resource_group_name" cty:"build_resource_group_name" hcl:"build_resource_group_name"` BuildKeyVaultName *string `mapstructure:"build_key_vault_name" cty:"build_key_vault_name" hcl:"build_key_vault_name"` + BuildKeyVaultSecretName *string `mapstructure:"build_key_vault_secret_name" cty:"build_key_vault_secret_name" hcl:"build_key_vault_secret_name"` BuildKeyVaultSKU *string `mapstructure:"build_key_vault_sku" cty:"build_key_vault_sku" hcl:"build_key_vault_sku"` DiskEncryptionSetId *string `mapstructure:"disk_encryption_set_id" cty:"disk_encryption_set_id" hcl:"disk_encryption_set_id"` PrivateVirtualNetworkWithPublicIp *bool `mapstructure:"private_virtual_network_with_public_ip" required:"false" cty:"private_virtual_network_with_public_ip" hcl:"private_virtual_network_with_public_ip"` @@ -212,6 +213,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "temp_resource_group_name": &hcldec.AttrSpec{Name: "temp_resource_group_name", Type: cty.String, Required: false}, "build_resource_group_name": &hcldec.AttrSpec{Name: "build_resource_group_name", Type: cty.String, Required: false}, "build_key_vault_name": &hcldec.AttrSpec{Name: "build_key_vault_name", Type: cty.String, Required: false}, + "build_key_vault_secret_name": &hcldec.AttrSpec{Name: "build_key_vault_secret_name", Type: cty.String, Required: false}, "build_key_vault_sku": &hcldec.AttrSpec{Name: "build_key_vault_sku", Type: cty.String, Required: false}, "disk_encryption_set_id": &hcldec.AttrSpec{Name: "disk_encryption_set_id", Type: cty.String, Required: false}, "private_virtual_network_with_public_ip": &hcldec.AttrSpec{Name: "private_virtual_network_with_public_ip", Type: cty.Bool, Required: false}, diff --git a/builder/azure/arm/step_certificate_in_keyvault.go b/builder/azure/arm/step_certificate_in_keyvault.go index 854cf758..4495dfab 100644 --- a/builder/azure/arm/step_certificate_in_keyvault.go +++ b/builder/azure/arm/step_certificate_in_keyvault.go @@ -61,7 +61,8 @@ func (s *StepCertificateInKeyVault) Run(ctx context.Context, state multistep.Sta var keyVaultName = state.Get(constants.ArmKeyVaultName).(string) var subscriptionId = state.Get(constants.ArmSubscription).(string) var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string) - id := secrets.NewSecretID(subscriptionId, resourceGroupName, keyVaultName, DefaultSecretName) + var keyVaultSecretName = state.Get(constants.ArmKeyVaultSecretName).(string) + id := secrets.NewSecretID(subscriptionId, resourceGroupName, keyVaultName, keyVaultSecretName) err := s.set(ctx, id) if err != nil { s.error(fmt.Errorf("Error setting winrm cert in custom keyvault: %s", err)) diff --git a/builder/azure/arm/step_certificate_in_keyvault_test.go b/builder/azure/arm/step_certificate_in_keyvault_test.go index 4f2f40c2..ddad85a4 100644 --- a/builder/azure/arm/step_certificate_in_keyvault_test.go +++ b/builder/azure/arm/step_certificate_in_keyvault_test.go @@ -19,6 +19,7 @@ func TestNewStepCertificateInKeyVault(t *testing.T) { state.Put(constants.ArmKeyVaultName, "testKeyVaultName") state.Put(constants.ArmSubscription, "testSubscription") state.Put(constants.ArmResourceGroupName, "testResourceGroupName") + state.Put(constants.ArmKeyVaultSecretName, "testKeyVaultSecretName") config := &Config{ winrmCertificate: "testCertificateString", @@ -44,6 +45,7 @@ func TestNewStepCertificateInKeyVault_error(t *testing.T) { state.Put(constants.ArmKeyVaultName, "testKeyVaultName") state.Put(constants.ArmSubscription, "testSubscription") state.Put(constants.ArmResourceGroupName, "testResourceGroupName") + state.Put(constants.ArmKeyVaultSecretName, "testKeyVaultSecretName") config := &Config{ winrmCertificate: "testCertificateString", diff --git a/builder/azure/arm/step_get_certificate.go b/builder/azure/arm/step_get_certificate.go index 422908dc..266a3d85 100644 --- a/builder/azure/arm/step_get_certificate.go +++ b/builder/azure/arm/step_get_certificate.go @@ -56,14 +56,15 @@ func (s *StepGetCertificate) Run(ctx context.Context, state multistep.StateBag) var keyVaultName = state.Get(constants.ArmKeyVaultName).(string) var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string) var subscriptionId = state.Get(constants.ArmSubscription).(string) + var keyVaultSecretName = state.Get(constants.ArmKeyVaultSecretName).(string) s.say(fmt.Sprintf(" -> Key Vault Name : '%s'", keyVaultName)) - s.say(fmt.Sprintf(" -> Key Vault Secret Name : '%s'", DefaultSecretName)) + s.say(fmt.Sprintf(" -> Key Vault Secret Name : '%s'", keyVaultSecretName)) var err error var url string for i := 0; i < 5; i++ { - url, err = s.get(ctx, subscriptionId, resourceGroupName, keyVaultName, DefaultSecretName) + url, err = s.get(ctx, subscriptionId, resourceGroupName, keyVaultName, keyVaultSecretName) if err == nil { break } diff --git a/builder/azure/arm/step_get_certificate_test.go b/builder/azure/arm/step_get_certificate_test.go index 4c8dd012..b9954853 100644 --- a/builder/azure/arm/step_get_certificate_test.go +++ b/builder/azure/arm/step_get_certificate_test.go @@ -82,7 +82,10 @@ func TestStepGetCertificateShouldTakeStepArgumentsFromStateBag(t *testing.T) { if actualKeyVaultName != expectedKeyVaultName { t.Fatal("Expected StepGetCertificate to source 'constants.ArmKeyVaultName' from the state bag, but it did not.") } - if actualSecretName != DefaultSecretName { + + var expectedKeyVaultSecretName = stateBag.Get(constants.ArmKeyVaultSecretName).(string) + + if actualSecretName != expectedKeyVaultSecretName { t.Fatal("Expected StepGetCertificate to use default value for secret, but it did not.") } @@ -101,5 +104,6 @@ func createTestStateBagStepGetCertificate() multistep.StateBag { stateBag.Put(constants.ArmKeyVaultName, "Unit Test: KeyVaultName") stateBag.Put(constants.ArmSubscription, "testSubscription") stateBag.Put(constants.ArmResourceGroupName, "testResourceGroupName") + stateBag.Put(constants.ArmKeyVaultSecretName, "testKeyVaultSecretName") return stateBag } diff --git a/builder/azure/arm/template_factory.go b/builder/azure/arm/template_factory.go index d1a4d6ad..cc0ad060 100644 --- a/builder/azure/arm/template_factory.go +++ b/builder/azure/arm/template_factory.go @@ -49,6 +49,7 @@ func GetKeyVaultDeployment(config *Config, secretValue string, exp *int64) (*dep params := &template.TemplateParameters{ KeyVaultName: &template.TemplateParameter{Value: config.tmpKeyVaultName}, KeyVaultSKU: &template.TemplateParameter{Value: config.BuildKeyVaultSKU}, + KeyVaultSecretName: &template.TemplateParameter{Value: config.BuildKeyVaultSecretName}, KeyVaultSecretValue: &template.TemplateParameter{Value: secretValue}, ObjectId: &template.TemplateParameter{Value: config.ClientConfig.ObjectID}, TenantId: &template.TemplateParameter{Value: config.ClientConfig.TenantID}, diff --git a/builder/azure/arm/template_factory_test.TestKeyVaultDeployment03.approved.json b/builder/azure/arm/template_factory_test.TestKeyVaultDeployment03.approved.json index c4f85c6a..331490d5 100644 --- a/builder/azure/arm/template_factory_test.TestKeyVaultDeployment03.approved.json +++ b/builder/azure/arm/template_factory_test.TestKeyVaultDeployment03.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "keyVaultName": { @@ -8,6 +8,9 @@ "keyVaultSKU": { "type": "string" }, + "keyVaultSecretName": { + "type": "string" + }, "keyVaultSecretValue": { "type": "securestring" }, @@ -47,30 +50,32 @@ }, "tenantId": "[parameters('tenantId')]" }, - "resources": [ - { - "apiVersion": "[variables('apiVersion')]", - "dependsOn": [ - "[concat('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]" - ], - "name": "[variables('keyVaultSecretName')]", - "properties": { - "value": "[parameters('keyVaultSecretValue')]" - }, - "type": "secrets" - } - ], "tags": { "tag01": "value01", "tag02": "value02", "tag03": "value03" }, "type": "Microsoft.KeyVault/vaults" + }, + { + "apiVersion": "[variables('apiVersion')]", + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]" + ], + "name": "[format('{0}/{1}', parameters('keyVaultName'), parameters('keyVaultSecretName'))]", + "properties": { + "value": "[parameters('keyVaultSecretValue')]" + }, + "tags": { + "tag01": "value01", + "tag02": "value02", + "tag03": "value03" + }, + "type": "Microsoft.KeyVault/vaults/secrets" } ], "variables": { - "apiVersion": "2015-06-01", - "keyVaultSecretName": "packerKeyVaultSecret", + "apiVersion": "2022-07-01", "location": "[resourceGroup().location]" } } \ No newline at end of file diff --git a/builder/azure/arm/template_factory_test.TestKeyVaultDeployment04.approved.json b/builder/azure/arm/template_factory_test.TestKeyVaultDeployment04.approved.json index e25d3b30..4e7f2d28 100644 --- a/builder/azure/arm/template_factory_test.TestKeyVaultDeployment04.approved.json +++ b/builder/azure/arm/template_factory_test.TestKeyVaultDeployment04.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "keyVaultName": { @@ -8,6 +8,9 @@ "keyVaultSKU": { "type": "string" }, + "keyVaultSecretName": { + "type": "string" + }, "keyVaultSecretValue": { "type": "securestring" }, @@ -47,28 +50,25 @@ }, "tenantId": "[parameters('tenantId')]" }, - "resources": [ - { - "apiVersion": "[variables('apiVersion')]", - "dependsOn": [ - "[concat('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]" - ], - "name": "[variables('keyVaultSecretName')]", - "properties": { - "attributes": { - "exp": 4102444800 - }, - "value": "[parameters('keyVaultSecretValue')]" - }, - "type": "secrets" - } - ], "type": "Microsoft.KeyVault/vaults" + }, + { + "apiVersion": "[variables('apiVersion')]", + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]" + ], + "name": "[format('{0}/{1}', parameters('keyVaultName'), parameters('keyVaultSecretName'))]", + "properties": { + "attributes": { + "exp": 4102444800 + }, + "value": "[parameters('keyVaultSecretValue')]" + }, + "type": "Microsoft.KeyVault/vaults/secrets" } ], "variables": { - "apiVersion": "2015-06-01", - "keyVaultSecretName": "packerKeyVaultSecret", + "apiVersion": "2022-07-01", "location": "[resourceGroup().location]" } } \ No newline at end of file diff --git a/builder/azure/arm/template_factory_test.TestPlanInfo01.approved.json b/builder/azure/arm/template_factory_test.TestPlanInfo01.approved.json index 8153755e..041209df 100644 --- a/builder/azure/arm/template_factory_test.TestPlanInfo01.approved.json +++ b/builder/azure/arm/template_factory_test.TestPlanInfo01.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -65,7 +65,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -92,7 +92,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -124,7 +124,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -192,7 +192,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -206,7 +206,7 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "tags": { "PlanInfo": "planName00", @@ -219,12 +219,9 @@ ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -232,7 +229,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestPlanInfo02.approved.json b/builder/azure/arm/template_factory_test.TestPlanInfo02.approved.json index 2cb785f9..7246f07c 100644 --- a/builder/azure/arm/template_factory_test.TestPlanInfo02.approved.json +++ b/builder/azure/arm/template_factory_test.TestPlanInfo02.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -66,7 +66,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -94,7 +94,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -127,7 +127,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -197,7 +197,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -211,7 +211,7 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "tags": { "PlanInfo": "planName00", @@ -225,12 +225,9 @@ ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -238,7 +235,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestTrustedLaunch01.approved.json b/builder/azure/arm/template_factory_test.TestTrustedLaunch01.approved.json index 72600621..ac848681 100644 --- a/builder/azure/arm/template_factory_test.TestTrustedLaunch01.approved.json +++ b/builder/azure/arm/template_factory_test.TestTrustedLaunch01.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -171,7 +171,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -185,19 +185,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2020-12-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -205,7 +202,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment03.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment03.approved.json index 420caec7..a18d7aa4 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment03.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment03.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -163,7 +163,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -177,19 +177,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -197,7 +194,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment04.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment04.approved.json index e9ca27db..e258876a 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment04.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment04.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -161,7 +161,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -175,19 +175,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -195,7 +192,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment05.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment05.approved.json index bd7dbeca..281368ea 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment05.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment05.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [], "location": "[variables('location')]", "name": "[parameters('nicName')]", @@ -67,7 +67,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -122,7 +122,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -136,19 +136,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -156,7 +153,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "virtualNetworkName", "virtualNetworkResourceGroup": "virtualNetworkResourceGroupName", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment06.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment06.approved.json index f6813ab9..97e86be9 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment06.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment06.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -64,7 +64,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -90,7 +90,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -121,7 +121,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -181,7 +181,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -195,7 +195,7 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "tags": { "tag01": "value01", @@ -207,12 +207,9 @@ ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -220,7 +217,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment07.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment07.approved.json index f424359f..ba5a05aa 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment07.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment07.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -162,7 +162,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -176,19 +176,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -196,7 +193,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json index d4074d0a..b975d6f9 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -161,7 +161,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -175,19 +175,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -195,7 +192,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json index 4c8fac57..510d5ef8 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -164,7 +164,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -178,19 +178,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -198,7 +195,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json index e87fd43b..d764dc45 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]" ], @@ -84,7 +84,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -142,7 +142,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -156,19 +156,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -176,7 +173,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "--virtual_network_name--", "virtualNetworkResourceGroup": "--virtual_network_resource_group_name--", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment11.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment11.approved.json index e38ab454..3b7d02a4 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment11.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment11.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -175,7 +175,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -189,19 +189,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -209,7 +206,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment12.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment12.approved.json index db97e37c..3a3f57dd 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment12.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment12.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -176,7 +176,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -190,19 +190,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -210,7 +207,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment13.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment13.approved.json index 4cde2f19..d7195fae 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment13.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment13.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -85,7 +85,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -157,7 +157,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -171,12 +171,12 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" }, { - "apiVersion": "[variables('networkSecurityGroupsApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('nsgName')]", "properties": { @@ -203,7 +203,7 @@ "type": "Microsoft.Network/networkSecurityGroups" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkSecurityGroups/', parameters('nsgName'))]" ], @@ -232,12 +232,9 @@ ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -245,7 +242,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment14.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment14.approved.json index 1187813a..8fa97906 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment14.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment14.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -162,7 +162,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -176,19 +176,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -196,7 +193,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment15.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment15.approved.json index eeb6d2dd..f376ca8a 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment15.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment15.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -168,7 +168,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -182,19 +182,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -202,7 +199,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment16.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment16.approved.json index 73f5a4fc..96a4a80b 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment16.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment16.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -148,7 +148,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -162,19 +162,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -182,7 +179,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType01.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType01.approved.json index e158fb78..0b2ac157 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType01.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType01.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -163,7 +163,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -177,19 +177,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -197,7 +194,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType02.approved.json b/builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType02.approved.json index c307b209..ba86b62a 100644 --- a/builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType02.approved.json +++ b/builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentLicenseType02.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -164,7 +164,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -178,19 +178,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -198,7 +195,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/constants/stateBag.go b/builder/azure/common/constants/stateBag.go index 4670bdb0..2da0e55d 100644 --- a/builder/azure/common/constants/stateBag.go +++ b/builder/azure/common/constants/stateBag.go @@ -27,6 +27,7 @@ const ( ArmDeploymentName string = "arm.DeploymentName" ArmNicName string = "arm.NicName" ArmKeyVaultName string = "arm.KeyVaultName" + ArmKeyVaultSecretName string = "arm.KeyVaultSecretName" ArmLocation string = "arm.Location" ArmOSDiskUri string = "arm.OSDiskUri" ArmAdditionalDiskVhds string = "arm.AdditionalDiskVhds" diff --git a/builder/azure/common/template/TestBuildLinux02.approved.txt b/builder/azure/common/template/TestBuildLinux02.approved.txt deleted file mode 100644 index 97aad4de..00000000 --- a/builder/azure/common/template/TestBuildLinux02.approved.txt +++ /dev/null @@ -1,120 +0,0 @@ -{ - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", - "contentVersion": "1.0.0.0", - "parameters": { - "adminPassword": { - "type": "string" - }, - "adminUsername": { - "type": "string" - }, - "dnsNameForPublicIP": { - "type": "string" - }, - "osDiskName": { - "type": "string" - }, - "storageAccountBlobEndpoint": { - "type": "string" - }, - "vmName": { - "type": "string" - }, - "vmSize": { - "type": "string" - } - }, - "variables": { - "addressPrefix": "10.0.0.0/16", - "apiVersion": "2015-06-15", - "location": "[resourceGroup().location]", - "nicName": "packerNic", - "publicIPAddressName": "packerPublicIP", - "publicIPAddressType": "Dynamic", - "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", - "subnetAddressPrefix": "10.0.0.0/24", - "subnetName": "--subnet-name--", - "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", - "virtualNetworkName": "--virtual-network--", - "virtualNetworkResourceGroup": "--virtual-network-resource-group--", - "vmStorageAccountContainerName": "images", - "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" - }, - "resources": [ - { - "apiVersion": "[variables('apiVersion')]", - "name": "[variables('nicName')]", - "type": "Microsoft.Network/networkInterfaces", - "location": "[variables('location')]", - "dependsOn": [], - "properties": { - "ipConfigurations": [ - { - "properties": { - "privateIPAllocationMethod": "Dynamic", - "subnet": { - "id": "[variables('subnetRef')]" - } - }, - "name": "ipconfig" - } - ] - } - }, - { - "apiVersion": "[variables('apiVersion')]", - "name": "[parameters('vmName')]", - "type": "Microsoft.Compute/virtualMachines", - "location": "[variables('location')]", - "dependsOn": [ - "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" - ], - "properties": { - "diagnosticsProfile": { - "bootDiagnostics": { - "enabled": false - } - }, - "hardwareProfile": { - "vmSize": "[parameters('vmSize')]" - }, - "networkProfile": { - "networkInterfaces": [ - { - "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" - } - ] - }, - "osProfile": { - "computerName": "[parameters('vmName')]", - "adminUsername": "[parameters('adminUsername')]", - "adminPassword": "[parameters('adminPassword')]", - "linuxConfiguration": { - "ssh": { - "publicKeys": [ - { - "path": "[variables('sshKeyPath')]", - "keyData": "--test-ssh-authorized-key--" - } - ] - } - } - }, - "storageProfile": { - "osDisk": { - "osType": "Linux", - "name": "[parameters('osDiskName')]", - "vhd": { - "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" - }, - "image": { - "uri": "http://azure/custom.vhd" - }, - "caching": "ReadWrite", - "createOption": "FromImage" - } - } - } - } - ] -} \ No newline at end of file diff --git a/builder/azure/common/template/template_builder.go b/builder/azure/common/template/template_builder.go index 7ba6388e..c7dcc9fc 100644 --- a/builder/azure/common/template/template_builder.go +++ b/builder/azure/common/template/template_builder.go @@ -20,6 +20,7 @@ const ( jsonIndent = " " resourceKeyVaults = "Microsoft.KeyVault/vaults" + resourceKeyVaultSecret = "Microsoft.KeyVault/vaults/secrets" resourceNetworkInterfaces = "Microsoft.Network/networkInterfaces" resourcePublicIPAddresses = "Microsoft.Network/publicIPAddresses" resourceVirtualMachine = "Microsoft.Compute/virtualMachines" @@ -27,8 +28,6 @@ const ( resourceNetworkSecurityGroups = "Microsoft.Network/networkSecurityGroups" variableSshKeyPath = "sshKeyPath" - - communityGalleryApiVersion = "2021-07-01" ) type TemplateBuilder struct { @@ -127,12 +126,12 @@ func (s *TemplateBuilder) BuildWindows(communicatorType string, keyVaultName str } func (s *TemplateBuilder) SetSecretExpiry(exp int64) error { - resource, err := s.getResourceByType(resourceKeyVaults) + resource, err := s.getResourceByType(resourceKeyVaultSecret) if err != nil { return err } - resources := *resource.Resources - resources[0].Properties.Attributes = &Attributes{ + + resource.Properties.Attributes = &Attributes{ Exp: exp, } return nil @@ -147,7 +146,6 @@ func (s *TemplateBuilder) SetIdentity(userAssignedManagedIdentities []string) er var id *Identity if len(userAssignedManagedIdentities) != 0 { - s.setVariable("apiVersion", "2018-06-01") // Required for user assigned managed identity id = &Identity{ Type: common.StringPtr("UserAssigned"), UserAssignedIdentities: make(map[string]struct{}), @@ -212,7 +210,6 @@ func (s *TemplateBuilder) SetSharedGalleryImage(location, imageID string, cachin return err } - s.setVariable("apiVersion", "2018-06-01") // Required for Shared Image Gallery profile := resource.Properties.StorageProfile profile.ImageReference = &hashiVMSDK.ImageReference{Id: &imageID} profile.OsDisk.OsType = s.osType @@ -228,7 +225,6 @@ func (s *TemplateBuilder) SetCommunityGalleryImage(location, imageID string, cac return err } - s.setVariable("apiVersion", communityGalleryApiVersion) // Required for Community Gallery Image profile := resource.Properties.StorageProfile profile.ImageReference = &hashiVMSDK.ImageReference{CommunityGalleryImageId: &imageID} profile.OsDisk.OsType = s.osType @@ -244,7 +240,6 @@ func (s *TemplateBuilder) SetDirectSharedGalleryImage(location, imageID string, return err } - s.setVariable("apiVersion", communityGalleryApiVersion) // Required for DirectShared Gallery Image profile := resource.Properties.StorageProfile profile.ImageReference = &hashiVMSDK.ImageReference{SharedGalleryImageId: &imageID} profile.OsDisk.OsType = s.osType @@ -393,7 +388,6 @@ func (s *TemplateBuilder) SetCustomData(customData string) error { } func (s *TemplateBuilder) SetUserData(userData string) error { - s.setVariable("apiVersion", "2021-03-01") // Userdata value only added in this schema resource, err := s.getResourceByType(resourceVirtualMachine) if err != nil { return err @@ -519,7 +513,6 @@ func (s *TemplateBuilder) SetLicenseType(licenseType string) error { } func (s *TemplateBuilder) SetSecurityProfile(secureBootEnabled bool, vtpmEnabled bool, encryptionAtHost bool) error { - s.setVariable("apiVersion", "2020-12-01") // Required for Trusted Launch resource, err := s.getResourceByType(resourceVirtualMachine) if err != nil { return err @@ -626,7 +619,7 @@ func (s *TemplateBuilder) deleteResourceDependency(resource *Resource, predicate func (s *TemplateBuilder) createNsgResource(srcIpAddresses []string, port int) (*Resource, string, string) { resource := &Resource{ - ApiVersion: common.StringPtr("[variables('networkSecurityGroupsApiVersion')]"), + ApiVersion: common.StringPtr("[variables('networkApiVersion')]"), Name: common.StringPtr("[parameters('nsgName')]"), Type: common.StringPtr(resourceNetworkSecurityGroups), Location: common.StringPtr("[variables('location')]"), @@ -666,7 +659,7 @@ func (s *TemplateBuilder) createNsgResource(srcIpAddresses []string, port int) ( // 1. The SDK defines no types for a Key Vault // 2. The Key Vault template is relatively simple, and is static. const KeyVault = `{ - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "keyVaultName": { @@ -675,25 +668,27 @@ const KeyVault = `{ "keyVaultSKU": { "type": "string" }, + "keyVaultSecretName": { + "type": "string" + }, "keyVaultSecretValue": { "type": "securestring" }, "objectId": { - "type": "string" + "type": "string" }, "tenantId": { "type": "string" } }, "variables": { - "apiVersion": "2015-06-01", - "location": "[resourceGroup().location]", - "keyVaultSecretName": "packerKeyVaultSecret" + "apiVersion": "2022-07-01", + "location": "[resourceGroup().location]" }, "resources": [ { - "apiVersion": "[variables('apiVersion')]", "type": "Microsoft.KeyVault/vaults", + "apiVersion": "[variables('apiVersion')]", "name": "[parameters('keyVaultName')]", "location": "[variables('location')]", "properties": { @@ -706,8 +701,8 @@ const KeyVault = `{ "tenantId": "[parameters('tenantId')]", "objectId": "[parameters('objectId')]", "permissions": { - "keys": [ "all" ], - "secrets": [ "all" ] + "keys": ["all"], + "secrets": ["all"] } } ], @@ -715,26 +710,24 @@ const KeyVault = `{ "name": "[parameters('keyVaultSKU')]", "family": "A" } + } + }, + { + "type": "Microsoft.KeyVault/vaults/secrets", + "apiVersion": "[variables('apiVersion')]", + "name": "[format('{0}/{1}', parameters('keyVaultName'), parameters('keyVaultSecretName'))]", + "properties": { + "value": "[parameters('keyVaultSecretValue')]" }, - "resources": [ - { - "apiVersion": "[variables('apiVersion')]", - "type": "secrets", - "name": "[variables('keyVaultSecretName')]", - "dependsOn": [ - "[concat('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]" - ], - "properties": { - "value": "[parameters('keyVaultSecretValue')]" - } - } + "dependsOn": [ + "[resourceId('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]" ] } ] }` const BasicTemplate = `{ - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminUsername": { @@ -782,13 +775,9 @@ const BasicTemplate = `{ }, "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "publicIPAddressApiVersion": "2017-04-01", - "virtualNetworksApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetName": "[parameters('subnetName')]", @@ -801,8 +790,8 @@ const BasicTemplate = `{ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", "type": "Microsoft.Network/publicIPAddresses", + "apiVersion": "[variables('networkApiVersion')]", "name": "[parameters('publicIPAddressName')]", "location": "[variables('location')]", "properties": { @@ -813,8 +802,8 @@ const BasicTemplate = `{ } }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "[variables('networkApiVersion')]", "name": "[variables('virtualNetworkName')]", "location": "[variables('location')]", "properties": { @@ -834,8 +823,8 @@ const BasicTemplate = `{ } }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "[variables('networkApiVersion')]", "name": "[parameters('nicName')]", "location": "[variables('location')]", "dependsOn": [ @@ -860,8 +849,8 @@ const BasicTemplate = `{ } }, { - "apiVersion": "[variables('apiVersion')]", "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "[variables('computeApiVersion')]", "name": "[parameters('vmName')]", "location": "[variables('location')]", "dependsOn": [ @@ -902,14 +891,14 @@ const BasicTemplate = `{ }, { "condition": "[not(empty(parameters('commandToExecute')))]", - "apiVersion": "2022-08-01", - "name": "[concat(parameters('vmName'), '/extension-customscript')]", "type": "Microsoft.Compute/virtualMachines/extensions", + "apiVersion": "[variables('computeApiVersion')]", + "name": "[concat(parameters('vmName'), '/extension-customscript')]", "location": "[variables('location')]", "properties": { "publisher": "Microsoft.Compute", "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8", + "typeHandlerVersion": "1.10", "autoUpgradeMinorVersion": true, "settings": { "commandToExecute": "[parameters('commandToExecute')]" diff --git a/builder/azure/common/template/template_builder_test.TestBuildEncryptedWindows.approved.json b/builder/azure/common/template/template_builder_test.TestBuildEncryptedWindows.approved.json index 04b196bc..0ee47392 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildEncryptedWindows.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildEncryptedWindows.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -209,7 +209,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -223,19 +223,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -243,7 +240,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestBuildLinux00.approved.json b/builder/azure/common/template/template_builder_test.TestBuildLinux00.approved.json index f100b704..95b46e6a 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildLinux00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildLinux00.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -163,7 +163,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -177,19 +177,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -197,7 +194,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestBuildLinux01.approved.json b/builder/azure/common/template/template_builder_test.TestBuildLinux01.approved.json index f9fa88a2..2ad5573f 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildLinux01.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildLinux01.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -161,7 +161,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -175,19 +175,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -195,7 +192,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestBuildLinux02.approved.json b/builder/azure/common/template/template_builder_test.TestBuildLinux02.approved.json index d4cf4940..1517abee 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildLinux02.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildLinux02.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [], "location": "[variables('location')]", "name": "[parameters('nicName')]", @@ -67,7 +67,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -123,7 +123,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -137,19 +137,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -157,7 +154,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "--virtual-network--", "virtualNetworkResourceGroup": "--virtual-network-resource-group--", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestBuildWindows00.approved.json b/builder/azure/common/template/template_builder_test.TestBuildWindows00.approved.json index 4c58556c..86747c4e 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildWindows00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildWindows00.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -177,7 +177,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -191,19 +191,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -211,7 +208,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestBuildWindows01.approved.json b/builder/azure/common/template/template_builder_test.TestBuildWindows01.approved.json index 08596624..6c1f64ae 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildWindows01.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildWindows01.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -200,7 +200,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -214,19 +214,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -234,7 +231,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestBuildWindows02.approved.json b/builder/azure/common/template/template_builder_test.TestBuildWindows02.approved.json index a1659e5b..92e30e48 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildWindows02.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildWindows02.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -193,7 +193,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -207,19 +207,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -227,7 +224,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestBuildWindows03.approved.json b/builder/azure/common/template/template_builder_test.TestBuildWindows03.approved.json index 2b30a2db..e5084777 100644 --- a/builder/azure/common/template/template_builder_test.TestBuildWindows03.approved.json +++ b/builder/azure/common/template/template_builder_test.TestBuildWindows03.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -169,7 +169,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -183,19 +183,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -203,7 +200,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestCommunitySharedImageGallery00.approved.json b/builder/azure/common/template/template_builder_test.TestCommunitySharedImageGallery00.approved.json index c16def88..13cb75b0 100644 --- a/builder/azure/common/template/template_builder_test.TestCommunitySharedImageGallery00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestCommunitySharedImageGallery00.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -158,7 +158,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -172,19 +172,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-07-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -192,7 +189,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestDirectSharedImageGallery00.approved.json b/builder/azure/common/template/template_builder_test.TestDirectSharedImageGallery00.approved.json index ab82a93d..ff881c79 100644 --- a/builder/azure/common/template/template_builder_test.TestDirectSharedImageGallery00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestDirectSharedImageGallery00.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -158,7 +158,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -172,19 +172,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-07-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -192,7 +189,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestLicenseType00.approved.json b/builder/azure/common/template/template_builder_test.TestLicenseType00.approved.json index 3f874922..b03f9724 100644 --- a/builder/azure/common/template/template_builder_test.TestLicenseType00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestLicenseType00.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -157,7 +157,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -171,19 +171,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -191,7 +188,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestLicenseType01.approved.json b/builder/azure/common/template/template_builder_test.TestLicenseType01.approved.json index 4a795823..bb7ba423 100644 --- a/builder/azure/common/template/template_builder_test.TestLicenseType01.approved.json +++ b/builder/azure/common/template/template_builder_test.TestLicenseType01.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -158,7 +158,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -172,19 +172,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -192,7 +189,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestNetworkSecurityGroup00.approved.json b/builder/azure/common/template/template_builder_test.TestNetworkSecurityGroup00.approved.json index 90a43de8..c84d0208 100644 --- a/builder/azure/common/template/template_builder_test.TestNetworkSecurityGroup00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestNetworkSecurityGroup00.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -85,7 +85,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -142,7 +142,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -156,12 +156,12 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" }, { - "apiVersion": "[variables('networkSecurityGroupsApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('nsgName')]", "properties": { @@ -188,7 +188,7 @@ "type": "Microsoft.Network/networkSecurityGroups" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkSecurityGroups/', parameters('nsgName'))]" ], @@ -217,12 +217,9 @@ ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2021-11-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -230,7 +227,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestSetIdentity00.approved.json b/builder/azure/common/template/template_builder_test.TestSetIdentity00.approved.json index e9750b1c..37afa461 100644 --- a/builder/azure/common/template/template_builder_test.TestSetIdentity00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestSetIdentity00.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -169,7 +169,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -183,19 +183,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2018-06-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -203,7 +200,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_builder_test.TestSharedImageGallery00.approved.json b/builder/azure/common/template/template_builder_test.TestSharedImageGallery00.approved.json index e8c795c0..1bc27e42 100644 --- a/builder/azure/common/template/template_builder_test.TestSharedImageGallery00.approved.json +++ b/builder/azure/common/template/template_builder_test.TestSharedImageGallery00.approved.json @@ -1,5 +1,5 @@ { - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { @@ -47,7 +47,7 @@ }, "resources": [ { - "apiVersion": "[variables('publicIPAddressApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[parameters('publicIPAddressName')]", "properties": { @@ -59,7 +59,7 @@ "type": "Microsoft.Network/publicIPAddresses" }, { - "apiVersion": "[variables('virtualNetworksApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "location": "[variables('location')]", "name": "[variables('virtualNetworkName')]", "properties": { @@ -80,7 +80,7 @@ "type": "Microsoft.Network/virtualNetworks" }, { - "apiVersion": "[variables('networkInterfacesApiVersion')]", + "apiVersion": "[variables('networkApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" @@ -106,7 +106,7 @@ "type": "Microsoft.Network/networkInterfaces" }, { - "apiVersion": "[variables('apiVersion')]", + "apiVersion": "[variables('computeApiVersion')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" ], @@ -158,7 +158,7 @@ "type": "Microsoft.Compute/virtualMachines" }, { - "apiVersion": "2022-08-01", + "apiVersion": "[variables('computeApiVersion')]", "condition": "[not(empty(parameters('commandToExecute')))]", "dependsOn": [ "[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" @@ -172,19 +172,16 @@ "commandToExecute": "[parameters('commandToExecute')]" }, "type": "CustomScriptExtension", - "typeHandlerVersion": "1.8" + "typeHandlerVersion": "1.10" }, "type": "Microsoft.Compute/virtualMachines/extensions" } ], "variables": { "addressPrefix": "10.0.0.0/16", - "apiVersion": "2018-06-01", + "computeApiVersion": "2023-03-01", "location": "[resourceGroup().location]", - "managedDiskApiVersion": "2017-03-30", - "networkInterfacesApiVersion": "2017-04-01", - "networkSecurityGroupsApiVersion": "2019-04-01", - "publicIPAddressApiVersion": "2017-04-01", + "networkApiVersion": "2023-04-01", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", @@ -192,7 +189,6 @@ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "[parameters('virtualNetworkName')]", "virtualNetworkResourceGroup": "[resourceGroup().name]", - "virtualNetworksApiVersion": "2017-04-01", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" } diff --git a/builder/azure/common/template/template_parameters.go b/builder/azure/common/template/template_parameters.go index f1ca2908..60aa9579 100644 --- a/builder/azure/common/template/template_parameters.go +++ b/builder/azure/common/template/template_parameters.go @@ -27,6 +27,7 @@ type TemplateParameters struct { DnsNameForPublicIP *TemplateParameter `json:"dnsNameForPublicIP,omitempty"` KeyVaultName *TemplateParameter `json:"keyVaultName,omitempty"` KeyVaultSKU *TemplateParameter `json:"keyVaultSKU,omitempty"` + KeyVaultSecretName *TemplateParameter `json:"keyVaultSecretName,omitempty"` KeyVaultSecretValue *TemplateParameter `json:"keyVaultSecretValue,omitempty"` ObjectId *TemplateParameter `json:"objectId,omitempty"` NicName *TemplateParameter `json:"nicName,omitempty"` diff --git a/docs-partials/builder/azure/arm/Config-not-required.mdx b/docs-partials/builder/azure/arm/Config-not-required.mdx index 82f14e40..1b3e9a5c 100644 --- a/docs-partials/builder/azure/arm/Config-not-required.mdx +++ b/docs-partials/builder/azure/arm/Config-not-required.mdx @@ -194,9 +194,11 @@ - `build_resource_group_name` (string) - Specify an existing resource group to run the build in. -- `build_key_vault_name` (string) - Specify an existing key vault to use for uploading certificates to the +- `build_key_vault_name` (string) - Specify an existing key vault to use for uploading the certificate for the instance to connect. +- `build_key_vault_secret_name` (string) - Specify the secret name to use for the certificate created in the key vault. + - `build_key_vault_sku` (string) - Specify the KeyVault SKU to create during the build. Valid values are standard or premium. The default value is standard.