Question may you can help me with...I'm trying to add a script to the image which will run only at provisioning of a VM from that image and take parameters from custom data. Where should I put the script in the image?
I think you should be able to place the script file anywhere you want in your image filesystem - as long as you use your OS-specific configuration to actually execute that script at the proper time on startup and prevent it from executing in the future once it did what it needed to do. If you want to run a dynamic script that's not part of the image and you are using ARM templates to deploy the VM, you can also use CustomScript VM extension to execute a script that is in the image already or downloaded from somewhere (docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-linux)
getting below error when i try to use the below command can you please help me here Packer build -var location=eastus2 -var sig_gallery_resource_group=avsig200 -var sig_gallery_name=avgallery200 -var sig_image_name=avimage200 -var sig_image_version=1.0.0 packer-sig-ubuntu.json azure-arm: output will be in this color. ==> azure-arm: Running builder ... Build 'azure-arm' errored after 2 milliseconds 202 microseconds: error fetching subscriptionID from VM metadata service for Managed Identity authentication: Get "169.254.169.254/metadata/instance/compute?api-version=2017-08-01&format=json": dial tcp 169.254.169.254:80: connectex: A socket operation was attempted to an unreachable network. ==> Wait completed after 2 milliseconds 202 microseconds ==> Some builds didn't complete successfully and had errors: --> azure-arm: error fetching subscriptionID from VM metadata service for Managed Identity authentication: Get "169.254.169.254/metadata/instance/compute?api-version=2017-08-01&format=json": dial tcp 169.254.169.254:80: connectex: A socket operation was attempted to an unreachable network. ==> Builds finished but no artifacts were created.
Have you confirmed that you properly set the environment variables in your terminal session for packer to use when authenticating to Azure Resource Manager? It should be the AZURE_SUBSCRIPTION_ID, AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET environment variables that need to be set to proper values depending on your terminal. See github.com/arsenvlad/azure-vm-offer-hello-world-202012/blob/main/packer/packer-sig.md#prepare
Question may you can help me with...I'm trying to add a script to the image which will run only at provisioning of a VM from that image and take parameters from custom data. Where should I put the script in the image?
I think you should be able to place the script file anywhere you want in your image filesystem - as long as you use your OS-specific configuration to actually execute that script at the proper time on startup and prevent it from executing in the future once it did what it needed to do. If you want to run a dynamic script that's not part of the image and you are using ARM templates to deploy the VM, you can also use CustomScript VM extension to execute a script that is in the image already or downloaded from somewhere (docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-linux)
getting below error when i try to use the below command can you please help me here
Packer build -var location=eastus2 -var sig_gallery_resource_group=avsig200 -var sig_gallery_name=avgallery200 -var sig_image_name=avimage200 -var sig_image_version=1.0.0 packer-sig-ubuntu.json
azure-arm: output will be in this color.
==> azure-arm: Running builder ...
Build 'azure-arm' errored after 2 milliseconds 202 microseconds: error fetching subscriptionID from VM metadata service for Managed Identity authentication: Get "169.254.169.254/metadata/instance/compute?api-version=2017-08-01&format=json": dial tcp 169.254.169.254:80: connectex: A socket operation was attempted to an unreachable network.
==> Wait completed after 2 milliseconds 202 microseconds
==> Some builds didn't complete successfully and had errors:
--> azure-arm: error fetching subscriptionID from VM metadata service for Managed Identity authentication: Get "169.254.169.254/metadata/instance/compute?api-version=2017-08-01&format=json": dial tcp 169.254.169.254:80: connectex: A socket operation was attempted to an unreachable network.
==> Builds finished but no artifacts were created.
Have you confirmed that you properly set the environment variables in your terminal session for packer to use when authenticating to Azure Resource Manager? It should be the AZURE_SUBSCRIPTION_ID, AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET environment variables that need to be set to proper values depending on your terminal. See github.com/arsenvlad/azure-vm-offer-hello-world-202012/blob/main/packer/packer-sig.md#prepare
@@ArsenVlad me too, getting the same error....
@@eanil7717 Have you tried the suggestion above to make sure you properly set the environment variables that are being used by packer?