Azure ARM Template osprofile dependency - azure

I have problem when creating my custom template. I am trying to create VM from vhd as vhd but in deployment it fail with error osProfile missing. It is interesting because in other template from internet I see there is no osprofile section and it is deploying without problems.
So I added osProfile with computerName parameter. But now deployment failing with error there is adminUsername and adminPassword needed. I don´t understand how is possible that in another script this is not requied and it will create VM without problems.
There is also fact that my template is creating VM using vhd but that other template is creating VM using managed disk. Is this possibly problematic?
My piece of code:
"apiVersion": "2017-03-30",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[concat(parameters('vmName'))]",
"adminUsername": "",
"adminPassword": ""
},
"storageProfile": {
"osDisk": {
"name": "[concat(parameters('vmName'),'-osDisk')]",
"osType": "[parameters('osType')]",
"caching": "ReadWrite",
"image": {
"uri": "[parameters('osVhdUri')]"
},
"vhd": {
"uri": "[variables('osDiskVhdName')]"
},
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', parameters('userDiagStorageAccountName')), '2016-01-01').primaryEndpoints.blob)]"
}
}
I know adminUsername and adminPassword can´t be empty but I don´t want this parameters in creating VM from existing vhd.
Piece of template code from deployment successful:
"apiVersion": "2017-03-30",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"location": "[parameters('location')]",
"tags": {
"displayName": "VirtualMachine"
},
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]",
"[concat(parameters('vmName'), '_OSdisk')]",
"[concat(parameters('vmName'), '_Datadisk')]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"storageProfile": {
"osDisk": {
"osType": "[parameters('osType')]",
"caching": "ReadWrite",
"createOption": "Attach",
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks', concat(parameters('vmName'), '_OSdisk'))]"
}
},
"dataDisks": [
{
"lun": 0,
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks', concat(parameters('vmName'), '_Datadisk'))]"
},
"caching": "ReadOnly",
"createOption": "Attach"
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('diagStorageAccountName')), '2016-01-01').primaryEndpoints.blob)]"
}
}
Here is printscreen of failed deployment without osProfile form my template.

change "createOption": "FromImage" to "createOption": "Attach". You are trying to create a VM from marketplace image, not from existing VHD.
in this case you can remove osProfile completely

Related

ARM template - multiple joindomain extensions

I'm trying to deploy 2 VM's (or more later on.. ) that then need to join the domain.. but the arm template doesnt want to work..
The VM's themselves deploy fine, but when it comes to the domain join extension. the line
"name": "[concat(variables('sqlNamePrefix'), padLeft(copyIndex(0),2, '0'), '/JoinDomain')]",
doesnt seem to work in this case.. I also tried to run some other options on this, but no luck as of yet..
any idea how to make this work?
"apiVersion": "2020-12-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('sqlNamePrefix'), copyindex())]",
"location": "[parameters('location')]",
"copy": {
"name": "virtualMachineLoop",
"count": 2
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkInterfaces',concat(variables('sqlNamePrefix'), copyindex(), '-nic'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('SqlVMSize')]"
},
"osProfile": {
"computerName": "[concat(variables('sqlNamePrefix'), copyindex())]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[parameters('windowsImagePublisher')]",
"offer": "[parameters('windowsImageOffer')]",
"sku": "[parameters('windowsImageSKU')]",
"version": "[parameters('windowsImageVersion')]"
},
"osDisk": {
"name": "[concat(variables('sqlNamePrefix'), copyindex(), '_OSDisk')]",
"caching": "ReadWrite",
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "[parameters('diskType')]"
}
},
"dataDisks": [
{
"lun": 0,
"name": "[concat(variables('sqlNamePrefix'), copyindex(), '_datadisk1')]",
"createOption": "Empty",
"diskSizeGB": "[variables('sqlDiskSize')]",
"caching": "None",
"managedDisk": {
"storageAccountType": "[parameters('diskType')]"
}
},
{
"lun": 1,
"name": "[concat(variables('sqlNamePrefix'), copyindex(), '_logdisk1')]",
"createOption": "Empty",
"diskSizeGB": "[variables('sqlDiskSize')]",
"caching": "None",
"managedDisk": {
"storageAccountType": "[parameters('diskType')]"
}
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('sqlNamePrefix'), copyindex(), '-nic'))]"
}
]
}
}
},
{
"apiVersion": "2016-03-30",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('sqlNamePrefix'), padLeft(copyIndex(0),2, '0'), '/JoinDomain')]",
"location": "[resourceGroup().location]",
"copy": {
"name": "DomainJoinLoop",
"count": "2"
},
"dependsOn": [ "virtualMachineLoop" ],
"properties":
{
"publisher": "Microsoft.Compute",
"type": "JsonADDomainExtension",
"typeHandlerVersion": "1.3",
"autoUpgradeMinorVersion": true,
"settings":
{
"Name": "[parameters('domainName')]",
"User": "[concat(parameters('domainName'), '\\', parameters('adminUsername'))]",
"OUPath": "[parameters('ouPath')]",
"Restart": "true",
"Options": "3"
},
"protectedsettings": {"Password": "[parameters('adminPassword')]"}
}
},
The first part of the name of the extension needs to match the parent vm's name... you don't have the pad() function in the vm name. So either need to add it there or change the extension name, e.g.
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('sqlNamePrefix', copyIndex(), '/JoinDomain')]",
Note, some extension types don't allow more than one per VM, IDK if the JsonADDomainExtension allows that but it will tell you if it doesn't once the name is fixed.

ARM- VMSS Output private ips of all instances

Im looking for a way to output all private ips of VMSS using outputs section in the ARM into an array. I have done a similar exercise to get public ip for a VM using the network interface ref [reference(variables('pipname')).ipAddress] and it worked, but here in VMSS since we do not have a NIC instance created, i'm not sure what object i need to reference. I looked online for documentation but could not find any. Please point me in the right direction. This is what i'm using
"variables": {
"appGatewayBackendPool": "appGatewayBackendPool",
"privateip": "/subscriptions/d6f9c1f8-f319-4a65-a590-86acc53e6e18/resourceGroups/maz-cac-iac-dal-gg-rg/providers/Microsoft.Compute/virtualMachineScaleSets/mazcaciacggapp/virtualMachines/networkInterfaces/mazcaciacggapp-nic"
},
"resources": [
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"name": "[concat(parameters('vmssName'))]",
"location": "[resourceGroup().location]",
"apiVersion": "2017-03-30",
"sku": {
"name": "[parameters('vmSku')]",
"capacity": "[parameters('instanceCount')]"
},
"properties": {
"overprovision": true,
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"storageProfile": {
"osDisk": {
"createOption": "FromImage",
"caching": "[parameters('osDiskCaching')]",
"managedDisk": {
"storageAccountType": "[parameters('osDiskStorageType')]"
}
},
"dataDisks": [
{
"lun": 0,
"createOption": "Empty",
"caching": "[parameters('dataDiskCaching')]",
"diskSizeGB": "[parameters('vmssDataDisk1Size')]",
"managedDisk": {
"storageAccountType": "[parameters('dataDiskStorageType')]"
}
},
{
"lun": 1,
"createOption": "Empty",
"caching": "[parameters('dataDiskCaching')]",
"diskSizeGB": "[parameters('vmssDataDisk2Size')]",
"managedDisk": {
"storageAccountType": "[parameters('dataDiskStorageType')]"
}
}
],
"imageReference": {
"publisher": "[parameters('imageReference.publisher')]",
"offer": "[parameters('imageReference.offer')]",
"sku": "[parameters('imageReference.sku')]",
"version": "[parameters('imageReference.version')]"
}
},
"osProfile": {
"computerNamePrefix": "[parameters('vmssName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"networkProfile": {
"networkInterfaceConfigurations": [
{
"name": "[concat(parameters('vmssName'), '-nic')]",
"properties": {
"primary": true,
"ipConfigurations": [
{
"name": "[concat(parameters('vmssName'), '-ipconfig')]",
"properties": {
"subnet": {
"id": "[resourceId(parameters('vnetResourceGroupName'),'Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
},
"ApplicationGatewayBackendAddressPools": [
{
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/applicationGateways/', parameters('appGatewayName'), '/backendAddressPools/', variables('appGatewayBackendPool'))]"
}
]
}
}
]
}
}
]
}
}
}
}
],
"outputs": {
"privateips": {
"type": "object",
"value": "[variables('privateip').IpConfigurations.PrivateIpAddress]",
}
}
}
resolved: used a powershell task in azure pipelines and set the ips as pipeline varibales

Azure Linux VM Template - Parameter osProfile not allowed but without I can't connect

I created a VM manually in Azure then used the automation script to generate a template to use from Visual Studio for a deployment however when I try to deploy it everything else works bar the VM which complains about the osProfile parameter, If I remove the osProfile section the deployment works but creates a VM I have no way to login to, all the examples I find say the osProfile I have should be fine so I'm a bit stuck
The template attached only works when the osProfile is commented out and then you can't login to the VM
Appreciate any suggestions as I've tried all sorts and am stumped now!
This is the error when the osProfile is included:
08:58:16 - Template deployment returned the following errors:
08:58:16 - 08:58:15 - Resource Microsoft.Compute/virtualMachines 'TheFaireyDevSolr' failed with message '{
08:58:16 - "error": {
08:58:16 - "code": "InvalidParameter",
08:58:16 - "target": "osProfile",
08:58:16 - "message": "Parameter 'osProfile' is not allowed."
08:58:16 - }
08:58:16 - }'
I updated the Password parameter to something more complex that I know meets the min reqs.
Below is the template json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "User name for the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Password for the Virtual Machine."
}
},
"disks_TheFaireyDevSolrDataDisk_name": {
"type": "string"
},
"disks_TheFaireyDevSolrOsDisk_name": {
"type": "string"
},
"virtualMachines_TheFaireyDevSolr_name": {
"type": "string"
},
"networkInterfaces_thefaireydevsolr_ni_name": {
"type": "string"
},
"networkSecurityGroups_TheFaireyDevSolr_nsg_name": {
"type": "string"
},
"publicIPAddresses_TheFaireyDevSolr_ip_name": {
"type": "string"
},
"virtualNetworks_TheFaireyDev_vnet_name": {
"type": "string"
},
"storageAccounts_thefaireydevmainstorage_name": {
"type": "string"
},
"extensions_Microsoft.Insights.VMDiagnosticsSettings_name": {
"type": "string"
}
},
"resources": [
{
"type": "Microsoft.Compute/disks",
"name": "[parameters('disks_TheFaireyDevSolrDataDisk_name')]",
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"accountType": "Standard_LRS",
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 32
},
"dependsOn": []
},
{
"type": "Microsoft.Compute/disks",
"name": "[parameters('disks_TheFaireyDevSolrOsDisk_name')]",
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"accountType": "Standard_LRS",
"osType": "Linux",
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/<YOUR SUBSCRIPTION ID>/Providers/Microsoft.Compute/Locations/uksouth/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer/Skus/17.04/Versions/latest"
}
},
"diskSizeGB": 30
},
"dependsOn": []
},
{
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('virtualMachines_TheFaireyDevSolr_name')]",
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"hardwareProfile": {
"vmSize": "Standard_A1_v2"
},
"storageProfile": {
"osDisk": {
"osType": "Linux",
"name": "[parameters('disks_TheFaireyDevSolrOSDisk_name')]",
"createOption": "Attach",
"caching": "ReadWrite",
"managedDisk": {
"storageAccountType": "Standard_LRS",
"id": "[resourceId('Microsoft.Compute/disks', parameters('disks_TheFaireyDevSolrOsDisk_name'))]"
},
"diskSizeGB": 30
},
"dataDisks": [
{
"lun": 0,
"name": "[concat(parameters('virtualMachines_TheFaireyDevSolr_name'),'DataDisk')]",
"createOption": "Attach",
"caching": "None",
"managedDisk": {
"storageAccountType": "Standard_LRS",
"id": "[resourceId('Microsoft.Compute/disks', parameters('disks_TheFaireyDevSolrDataDisk_name'))]"
},
"diskSizeGB": 32
}
]
},
"osProfile": {
"computerName": "[parameters('virtualMachines_TheFaireyDevSolr_name')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_thefaireydevsolr_ni_name'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('https', '://', parameters('storageAccounts_thefaireydevmainstorage_name'), '.blob.core.windows.net', '/')]"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/disks', parameters('disks_TheFaireyDevSolrOsDisk_name'))]",
"[resourceId('Microsoft.Compute/disks', parameters('disks_TheFaireyDevSolrDataDisk_name'))]",
"[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_thefaireydevsolr_ni_name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_thefaireydevmainstorage_name'))]"
]
},
{
"type": "Microsoft.Network/networkInterfaces",
"name": "[parameters('networkInterfaces_thefaireydevsolr_ni_name')]",
"apiVersion": "2017-03-01",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAddress": "10.0.0.4",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_TheFaireyDevSolr_ip_name'))]"
},
"subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworks_TheFaireyDev_vnet_name')), '/subnets/default')]"
}
}
}
],
"dnsSettings": {
"dnsServers": []
},
"enableIPForwarding": false,
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_TheFaireyDevSolr_nsg_name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_TheFaireyDevSolr_ip_name'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworks_TheFaireyDev_vnet_name'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_TheFaireyDevSolr_nsg_name'))]"
]
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[parameters('networkSecurityGroups_TheFaireyDevSolr_nsg_name')]",
"apiVersion": "2017-03-01",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"securityRules": [
{
"name": "default-allow-ssh",
"properties": {
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1000,
"direction": "Inbound"
}
}
]
},
"dependsOn": []
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[parameters('publicIPAddresses_TheFaireyDevSolr_ip_name')]",
"apiVersion": "2017-03-01",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"publicIPAllocationMethod": "Dynamic",
"idleTimeoutInMinutes": 4
},
"dependsOn": []
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('virtualNetworks_TheFaireyDev_vnet_name')]",
"apiVersion": "2017-03-01",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/24"
]
},
"subnets": [
{
"name": "default",
"properties": {
"addressPrefix": "10.0.0.0/24"
}
}
],
"virtualNetworkPeerings": []
},
"dependsOn": []
},
{
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "Storage",
"name": "[parameters('storageAccounts_thefaireydevmainstorage_name')]",
"apiVersion": "2016-01-01",
"location": "[resourceGroup().location]",
"tags": {},
"scale": null,
"properties": {},
"dependsOn": []
},
//{
// "type": "Microsoft.Compute/virtualMachines/extensions",
// "name": "[parameters('extensions_Microsoft.Insights.VMDiagnosticsSettings_name')]",
// "apiVersion": "2016-04-30-preview",
// "location": "[resourceGroup().location]",
// "scale": null,
// "properties": {
// "publisher": "Microsoft.OSTCExtensions",
// "type": "LinuxDiagnostic",
// "typeHandlerVersion": "2.3",
// "autoUpgradeMinorVersion": true,
// "settings": {
// "xmlCfg": "PFdhZENmZz48RGlhZ25vc3RpY01vbml0b3JDb25maWd1cmF0aW9uIG92ZXJhbGxRdW90YUluTUI9IjQwOTYiPjxEaWFnbm9zdGljSW5mcmFzdHJ1Y3R1cmVMb2dzIHNjaGVkdWxlZFRyYW5zZmVyUGVyaW9kPSJQVDFNIiBzY2hlZHVsZWRUcmFuc2ZlckxvZ0xldmVsRmlsdGVyPSJXYXJuaW5nIi8+PFBlcmZvcm1hbmNlQ291bnRlcnMgc2NoZWR1bGVkVHJhbnNmZXJQZXJpb2Q9IlBUMU0iPjxQZXJmb3JtYW5jZUNvdW50ZXJDb25maWd1cmF0aW9uIGNvdW50ZXJTcGVjaWZpZXI9IlxNZW1vcnlcQXZhaWxhYmxlTWVtb3J5IiBzYW1wbGVSYXRlPSJQVDE1UyIgdW5pdD0iQnl0ZXMiPjxhbm5vdGF0aW9uIGRpc3BsYXlOYW1lPSJNZW1vcnkgYXZhaWxhYmxlIiBsb2NhbGU9ImVuLXVzIi8+PC9QZXJmb3JtYW5jZUNvdW50ZXJDb25maWd1cmF0aW9uPjxQZXJmb3JtYW5jZUNvdW50ZXJDb25maWd1cmF0aW9uIGNvdW50ZXJ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mZXJQZXJpb2Q9IlBUMU0iLz48L01ldHJpY3M+PC9EaWFnbm9zdGljTW9uaXRvckNvbmZpZ3VyYXRpb24+PC9XYWRDZmc+"
// },
// "protectedSettings": {}
// },
// "dependsOn": [
// "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_TheFaireyDevSolr_name'))]"
// ]
//}
],
"variables": {}
}
and the parameters json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"value": "thefairey"
},
"disks_TheFaireyDevSolrDataDisk_name": {
"value": "TheFaireyDevSolrDataDisk"
},
"disks_TheFaireyDevSolrOsDisk_name": {
"value": "TheFaireyDevSolrOsDisk"
},
"virtualMachines_TheFaireyDevSolr_name": {
"value": "TheFaireyDevSolr"
},
"networkInterfaces_thefaireydevsolr_ni_name": {
"value": "TheFaireyDevSolr-ni"
},
"networkSecurityGroups_TheFaireyDevSolr_nsg_name": {
"value": "TheFaireyDevSolr-nsg"
},
"publicIPAddresses_TheFaireyDevSolr_ip_name": {
"value": "TheFaireyDevSolr-ip"
},
"virtualNetworks_TheFaireyDev_vnet_name": {
"value": "TheFaireyDev-vnet"
},
"storageAccounts_thefaireydevmainstorage_name": {
"value": "thefaireydevmainstorage"
},
"extensions_Microsoft.Insights.VMDiagnosticsSettings_name": {
"value": "TheFaireyDevSolr/Microsoft.Insights.VMDiagnosticsSettings"
}
}
}
UPDATE
I started with a plain Ubuntu VM template from VS and started adding stuff and the problem regarding the osProfile starts happening as soon as I try to add a Managed Disk as the OS disk, I removed that but tried with a managed disk for the DataDisk and got the error "Addition of a managed disk to a VM with blob based disks is not supported"
Not sure if it helps but I believe the issue may be related to having a Managed Disk as the OS disk. Will continue to research and experiment!
Ok worked it out, the automation script I guess isn't quite up to speed with Managed Disks which is fair enough as they are in preview, when I ran it it created a separate resource for the OS Managed disk.
In order to have a managed disk as the OS disk you need to define the storageProfile as follows:
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[parameters('ubuntuOSVersion')]",
"version": "latest"
},
"osDisk": {
"osType": "Linux",
"name": "YourOSDiskName",
"createOption": "FromImage",
"caching": "ReadWrite",
"managedDisk": {
"storageAccountType": "Standard_LRS"
},
"diskSizeGB": 32
},
}
The important thing is that you don't need to define the managed disk as a separate resource, it appears the VM creation handles creation of the Managed disk resource and you just need to specify the storageAccountType for the disk.
After that everything appears to work correctly.
Trying to Attach a previously defined Managed Disk based on an OS image and specifying the id parameter in the managedDisk settings in the VM doesn't appear to work.
Hope this helps someone!
osProfile is required if the VHD is sysprepped & generalized - meaning when it starts you want to run through first time setup. If the image is not generalized then you can't specify the osProfile (e.g. user/pass) because it already exists.
re: ManagedDisks - you can use an implicit disk or explicit. If you wanted to use one of your own disk images your storageProfile would be:
"storageProfile": {
"imageReference": {
"id": "[parameters('imageResourceId')]"
}
}
If you want to use your own disk (say, created from a snapshot) you would use:
"storageProfile": {
"osDisk": {
"osType": "[parameters('osType')]",
"name": "[parameters('managedOsDiskName')]",
"createOption": "Attach",
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks', parameters('managedOsDiskName'))]"
},
"caching": "ReadWrite"
}
}
There are a lot of options available w/ managed disks... This doc isn't perfect but does help.

Azure Resource Management List Virtual Guests /providers/Microsoft.Compute/virtualMachines?api-version=2015-06-15

Below mentioned API is used to invoke all virtual machines :
https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines?api-version=2015-06-15
In the response of virtual machines, virtual machine Id as mentioned here
"id": "/subscriptions/subscriptonId/resourceGroups/AGILITY/providers/Microsoft.Compute/virtualMachines/ProxyDontDelete10001",
in which resource group name is in Capital Letters (AGILITY) and if we invoke another rest api using this ID to get the instance view details it's not working.
/providers/Microsoft.Compute/virtualMachines/i-00000009/InstanceView
{
"value": [
{
"properties": {
"vmId": "7eb8dca3-dacf-4c51-b079-a508bf6d02b9",
"hardwareProfile": {
"vmSize": "Basic_A0"
},
"storageProfile": {
"osDisk": {
"osType": "Linux",
"name": "ProxyDontDelete10001",
"createOption": "FromImage",
"image": {
"uri": "https://blob.blob.core.windows.net/vhd/SM-RHEL6.7s-x64-9.2.r1664-20150801.vhd"
},
"vhd": {
"uri": "https://blob.blob.core.windows.net/vhds/ProxyDontDelete10001_ee751938-8d5c-468b-a36f-63e5332405cf.vhd"
},
"caching": "ReadWrite"
},
"dataDisks": [],
},
"osProfile": {
"computerName": "ProxyDontDelete10001",
"adminUsername": "admin",
"linuxConfiguration": {
"disablePasswordAuthentication": false
},
"secrets": [],
},
"networkProfile": {
"networkInterfaces": [
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/test/providers/Microsoft.Network/networkInterfaces/testProxyDontDelete10001_ee751938-8d5c-468b-a36f-63e5332405cf"
}
],
},
"provisioningState": "Succeeded"
},
"type": "Microsoft.Compute/virtualMachines",
"location": "westus",
"id": "/subscriptions/subscriptonId/resourceGroups/AGILITY/providers/Microsoft.Compute/virtualMachines/ProxyDontDelete10001",
"name": "ProxyDontDelete10001"
},
Ok, I'm not sure I entirely understand the question, but resource group name is not case sensitive, so doing to:
/subscriptions/subscriptonId/resourceGroups/agility/providers/Microsoft.Compute/virtualMachines/ProxyDontDelete10001
should also work.

output private ip of VM in azure ARM

I am spinning up more than one Azure VM using copyindex() in ARM template. Here is the resource I am using :
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(parameters('vmDnsPrefixClientNode'),copyIndex(1))]",
"location": "[resourceGroup().location]",
"copy": {
"name": "virtualMachineLoop",
"count": "[parameters('vmInstancesClientNode')]"
},
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'),copyindex(1))]",
"[concat('Microsoft.Network/networkInterfaces/', parameters('vmDnsPrefixClientNode'),copyindex(1),'-nic')]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSizeClientNode')]"
},
"osProfile": {
"computername": "[concat(parameters('vmDnsPrefixClientNode'), copyIndex(1))]",
"adminUsername": "[parameters('username')]",
"adminPassword": "[parameters('password')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('ubuntuOSVersion')]",
"version": "latest"
},
"osDisk": {
"name": "osdisk1",
"vhd": {
"uri": "[concat('http://',variables('storageAccountName'),copyindex(1),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',parameters('vmDnsPrefixClientNode'),copyIndex(1),'-osdisk1.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
},
"dataDisks": [
{
"name": "datadisk1",
"diskSizeGB": "10",
"lun": 0,
"vhd": {
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'),copyindex(1)), variables('apiVersion')).primaryEndpoints.blob, variables('vmDataContainerName'),'/',parameters('vmDnsPrefixClientNode'),copyIndex(1),'-',variables('dataDisk1VhdName'),'.vhd')]"
},
"createOption": "Empty"
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('vmDnsPrefixClientNode'),copyindex(1),'-nic'))]"
}
]
}
}
},
I tried something like this, which isn't working
"outputs": {
"privateIP": {
"value": "[reference(concat(parameters('vmDnsPrefixClientNode'),copyindex(1),'-nic'),providers('Microsoft.Network', 'privateIPAddresses').apiVersions[0]).dnsSettings.fqdn]",
"type": "string",
"copy": {
"name": "vmNic",
"count": "[parameters('vmInstancesClientNode')]"
}
}
}
anyone knows how to get private IP or internal FQDN in output ?
I have used the following code in my template to get the private ip address from network interface.
"outputs":{
"networkInterface":{
"value": "[reference(resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName')),'2016-09-01')]",
"type": "object"
}
}
Once you get the output, then you can find the IP address at
outputs.networkInterface.value.ipConfigurations[0].properties.privateIPAddress
and dns suffix at
outputs.networkInterface.value.dnsSettings.internalDomainNameSuffix

Resources