Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure managed disk: osDisk.managedDisk.id is not allowed #3290

Closed
vgaga84 opened this issue Apr 4, 2017 · 5 comments
Closed

Azure managed disk: osDisk.managedDisk.id is not allowed #3290

vgaga84 opened this issue Apr 4, 2017 · 5 comments

Comments

@vgaga84
Copy link

@vgaga84 vgaga84 commented Apr 4, 2017

Hi,

I am trying to deploy vm using json template with managed disk. I create the OsDisk from platform image, and when I want to use its Id in the virtual machine, I receive error: "osDis.managedDisk.id" is not allowed. When I manually created the vm on the azure portal, and exported the json template, the same approach was in the exported json template.
Managed disk resource:

{
"apiVersion": "2016-04-30-preview",
"type": "Microsoft.Compute/disks",
"name": "[variables('osDiskName')]",
"location": "[resourceGroup().location]",
"properties": {
"osType": "[parameters('OSType')]",
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "[variables('osReference')]"
}
},
"accountType": "Premium_LRS",
"diskSizeGB": "128"
}
}

Virtual Machine resource:

{
"apiVersion": "2016-04-30-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Compute/disks',variables('osDiskName'))]",
"[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]",
"datadiskCreation"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('VMSize')]"
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('AdminUsername')]",
"adminPassword": "[parameters('AdminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[parameters('OSPublisher')]",
"offer": "[parameters('OSOffer')]",
"sku": "[parameters('OSSKU')]",
"version": "latest"
},
"osDisk": {
"name": "[variables('osDiskName')]",
"caching": "ReadWrite",
"createOption": "FromImage",
"osType": "[parameters('OSType')]",
"managedDisk": {
"storageAccountType": "Premium_LRS",
"id": "[resourceId('Microsoft.Compute/disks',variables('osDiskName'))]"
},
"diskSizeGB": "128"
},
"dataDisks": [
{
"name": "[variables('serverDiskNames')[0]]",
"caching": "ReadWrite",
"createOption": "Attach",
"lun": 0,
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks',variables('serverDiskNames')[0])]"
}
},
{
"name": "[variables('serverDiskNames')[1]]",
"lun": 1,
"caching": "ReadWrite",
"createOption": "Attach",
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks',variables('serverDiskNames')[1])]"
}
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
}
}

I tried deploying with api version 2016-04-30-preview and 2017-03-30 but none of them worked.

Can you please help me to solve this issue?

Thanks!
Regards

@vgaga84 vgaga84 changed the title Azure manad disk: osDisk.managedDisk.id is not allowed Azure managed disk: osDisk.managedDisk.id is not allowed Apr 4, 2017
@arindam00
Copy link

@arindam00 arindam00 commented Apr 11, 2017

I was able to resolve the issue by removing ("id": "[resourceId('Microsoft.Compute/disks',variables('osDiskName'))]" ) in the script. However can anyone help me in understanding why adding the this line is not working in deploying VM using managed disk.

Replaced below line for OS disk

"managedDisk": {
"storageAccountType": "Premium_LRS",
"id": "[resourceId('Microsoft.Compute/disks',variables('osDiskName'))]"

with

"managedDisk": {
"storageAccountType": "Standard_LRS"

** Data disk not tested

Regards,
Arindam Dhar

@vgaga84
Copy link
Author

@vgaga84 vgaga84 commented Apr 12, 2017

Hi,

In this case it does not create me Premium disk for OS.
I figured out this working solution both for managed os (Premium_LRS) and data (Standard_LRS) disks:

{
"apiVersion": "2016-04-30-preview",
"type": "Microsoft.Compute/disks",
"name": "[variables('serverDiskNames')[copyIndex()]]",
"location": "[resourceGroup().location]",
"copy": {
"name": "datadiskCreation",
"count": "[length(variables('serverDiskNames'))]"
},
"properties": {
"creationData": {
"createOption": "empty"
},
"diskSizeGB": "[parameters('DataDisksSize')]"
},
"dependsOn": [
]
},
{
"apiVersion": "2016-04-30-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]",
"[resourceId('Microsoft.Storage/storageAccounts/', variables('bootDiagStorage'))]",
"datadiskCreation"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('VMSize')]"
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('AdminUsername')]",
"adminPassword": "[parameters('AdminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[parameters('OSPublisher')]",
"offer": "[parameters('OSOffer')]",
"sku": "[parameters('OSSKU')]",
"version": "latest"
},
"osDisk": {
"name": "[variables('osDiskName')]",
"caching": "ReadWrite",
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "Premium_LRS"
},
"diskSizeGB": "128"
},
"dataDisks": [
{
"name": "[variables('serverDiskNames')[0]]",
"caching": "ReadWrite",
"createOption": "Attach",
"lun": 0,
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks',variables('serverDiskNames')[0])]"
}
},
{
"name": "[variables('serverDiskNames')[1]]",
"lun": 1,
"caching": "ReadWrite",
"createOption": "Attach",
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks',variables('serverDiskNames')[1])]"
}
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('https://', variables('bootDiagStorage'), '.blob.core.windows.net')]"
}
}
}
}

@vremeni4
Copy link

@vremeni4 vremeni4 commented Feb 15, 2020

For me the only way to resolve this was to change the "createOption": from"attach" to
"Empty" for DataDisk, also I had to remove the ID.
As last thing I had to add "adminPassword": as this is removed when you export the template
Now I have a template with the Admin password in plain text ?!?!?
I think it would be better to get the option/field when deploying the template to insert the password. How it works now it is just mickey mouse thing.
----snip-----
"osDisk": {
"osType": "Windows",
"name": "[concat(parameters('virtualMachines_testtempl_name'), '_OsDisk_1_5975f1147925449e91afb6981c977783')]",
"createOption": "FromImage",
"caching": "ReadWrite",
"managedDisk": {
"storageAccountType": "Standard_LRS"
},
"diskSizeGB": 127
},
"dataDisks": [
{
"lun": 0,
"name": "[concat(parameters('virtualMachines_testtempl_name'), '_DataDisk_0')]",
"createOption": "Empty",
"caching": "None",
"writeAcceleratorEnabled": false,
"managedDisk": {
"storageAccountType": "Standard_LRS"
},
"diskSizeGB": 128,
"toBeDetached": false
}
]
},
----snip---
In the time I spent fixing this stupid issues with the template I could have deployed 4 Resource Groups of the same type.
So what is the point of the template, if it does not work ?
It works for simple things, as soon as the template contains a bit more we get plenty of issues. :-(

@dhananjayzambre
Copy link

@dhananjayzambre dhananjayzambre commented Apr 22, 2020

  • Am also facing the same issue,

  • On the removal of id line from the osDisk, getting an error

"The property 'requireGuestProvisionSignal' is not valid because the 'Microsoft.Compute/Agentless' feature is not enabled for this subscription"

  • Below is the template am using. Is there any other suggestion on this?

"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2019-07-01",
"name": "MyvirtualMachines",
"location": "[parameters('location')]",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_DS2_v2"
},
"storageProfile": {
"imageReference": {
"id": "[parameters('test_image_name')]"
},
"osDisk": {
"osType": "Linux",
"name": "disk.vhd",
"createOption": "FromImage",
"caching": "ReadWrite",
"writeAcceleratorEnabled": false,
"managedDisk": {
"storageAccountType": "Premium_LRS",
"id": "[resourceId('Microsoft.Compute/disks','disk.vhd')]"
},
"diskSizeGB": 150
},
"dataDisks": []
},
"osProfile": {
"computerName": "testpks-ops-manager",
"adminUsername": "ubuntu",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {

@adritrix
Copy link

@adritrix adritrix commented May 15, 2020

@dhananjayzambre I'm having the same problem as you. Did you fix it? If so I would appreciate your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.