Hi,
When I deploy a VM in Azure using the JSON template extracted from the .VHD file created by packer its giving me error to use CreateOption=Attach instead of the CreateOption=FromImage. But when I use "Attach' option its giving me below error.
{
"error": {
"code": "PropertyChangeNotAllowed",
"target": "osDisk.createOption",
"message": "Changing property 'osDisk.createOption' is not allowed."
}
}
Below is the JSON used for creating VHD file.
{
"builders": [{
"type": "azure-arm",
"client_id": "xxxxx",
"client_secret": "xxxx",
"resource_group_name": "PackerGroup",
"storage_account": "packergroupdisks952",
"subscription_id": "xxxxx",
"tenant_id": "xxxxx",
"capture_container_name": "images",
"capture_name_prefix": "packer",
"os_type": "Linux",
"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "16.04-LTS",
"azure_tags": {
"dept": "engineering"
},
"location": "South India",
"vm_size": "Standard_A0"
}]
}
Below is the JSON extracted out of the .VHD file created from Azure.
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/VM_IP.json",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A0"
},
"adminUserName": {
"type": "string"
},
"adminPassword": {
"type": "securestring"
},
"networkInterfaceId": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2016-03-30",
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"storageProfile": {
"osDisk": {
"osType": "Linux",
"name": "packer-osDisk.removed_id.vhd",
"createOption": "FromImage",
"image": {
"uri": "https://packergroupdisks952.blob.core.windows.net/system/Microsoft.Compute/Images/images/packer-osDisk.removed_id.vhd"
},
"vhd": {
"uri": "https://packergroupdisks952.blob.core.windows.net/vmcontainerfaee5d49-79de-41c5-b72f-7d553cde2818/osDisk.removed_id.vhd"
},
"caching": "ReadWrite"
}
},
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"networkProfile": {"networkInterfaces":[{"id":"[parameters('networkInterfaceId')]"}]},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": false
}
},
"provisioningState": 0
},
"type": "Microsoft.Compute/virtualMachines",
"location": "SouthIndia",
"name": "[parameters('vmName')]"
}
]
}
Packer version is 0.12.0
I followed https://www.packer.io/docs/builders/azure.html to create this.
Please advise
Thanks in advance
Shyam
The Azure quickstart templates for from image is a good starting example.
The VHD pointed to by the VHD URI does not exist, correct? Only the VHD pointed to by the Image URI should exist.
Yes right only the Image URI exist.
I would like to have the my JSON working if I can make some edits to it.
Thanks
Shyam
Please use the quick start templates as a guide. They are good examples of what you need to include in your template.
Hi @shyam2j I am experiencing the same issue: did you manage to resolve it?
Version 0.12.1
Thank you
No Francesco, I didn't spend time on it after that. Please post here if you
are manage to resolve it :)
Thanks
Shyam
On 11 Jan 2017 2:14 p.m., "Francesco Gualazzi" notifications@github.com
wrote:
Hi @shyam2j https://github.com/shyam2j I am experiencing the same issue:
did you manage to resolve it?
Thank you
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mitchellh/packer/issues/4330#issuecomment-271810801,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AXR0H9mqU9eMlZAmlRID_ZlcWprR5SGbks5rRJZ3gaJpZM4LWsQz
.
Hi guys,
just a hint, please check schema template version as well as versions of api available in given Azure region. Could be related.
I am seeing same issue. Has anyone tried rolling back to 12.0 version of packer to see if it repros?
It seems that packer make generalize incorect. When I try to kill packer before it generalize image and make it by powershell, all works fine.
Our issue was a missing step in packer template that removes waagent. We resolved by adding a provisioner step similar to what is in example template here https://github.com/mitchellh/packer/blob/master/examples/azure/ubuntu.json.
+1
I think there are a couple of issues, but they all start with you have a custom image, and now you want to deploy it.
Are there any issues that I am missing?
What's the best way to fix these issues? Here are some ideas.
What do you think?
I think it would help if the ARM template generated by the Azure builder was a complete one instead of partial. e.g. it would need to include a VNet, NIC, Public IP, and it should use the storage account configured in the builder config (since this is where the final image lives).
Also it should be clearly documented that the de-provisioning steps must be performed via a provisioner: since they are Azure specific this is not shown in examples based on other builders. And the Windows examples should include the corresponding "sysprep /generalize" stanza...
The waagent step should be part of the builder...
The examples all include a deprovision step, but the invocation is specific to the customer. We used to include deprovision in the builder, but people asked us to remove it. We cannot please everyone. 😄 Our compromise is to include them in every example, and to document them.
Windows VMs on Azure do not require an agent, and Linux will soon not require an agent. In that case, deprovision makes no sense. Cloud-init will handle any provisioning tasks, and end-users will never have to execute deprovision. Arguably, cloud-init should have been the default mechanism from beginning, but that ship has sailed.
The Azure agent (>= 2.2.11) will emit an error on provision if it detects that a VM was not properly deprovisioned ahead of time, see this issue. This will better signify the error case, and hopefully inform the user of the expected course of action.
I think this issue has concluded, and I am closing it. Documentation has been updated, newer versions of the agent will fail appropriately in the case of Linux, and activity on the issue appears to have stopped. If there are other particulars that need to be surfaced let's open an issue focus on that.
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Our issue was a missing step in packer template that removes waagent. We resolved by adding a provisioner step similar to what is in example template here https://github.com/mitchellh/packer/blob/master/examples/azure/ubuntu.json.