mark
mark

Reputation: 2063

Programmatically get Azure VM Image Blob URI

I created a custom Azure VM image but am unable to find the image's blob URI, which I need to specify in a deployment template's scale set.

How can I find the image's blob URI given the name and resource group of the image using the Azure CLI?

Upvotes: 0

Views: 1144

Answers (2)

Nancy Xiong
Nancy Xiong

Reputation: 28224

If you create a managed image of a generalized VM in Azure. You can not get the Image URL since the image is managed by Azure. But you can get the source OsDisk VHD URL.

You can find the source OsDisk URL in the portal from the generalized VM---source OsDisk---Export---Generate URL, you will find the SAS URL for the OsDisk. Refer to this. Or you can run the script with CLI to find the SAS URL.

az disk grant-access --duration-in-seconds 3600 --name $OsDiskname  --resource-group $resourcegroupname

Here is a similar case for your reference. Hope this helps.

Upvotes: 0

bmoore-msft
bmoore-msft

Reputation: 8717

az vm show -g <resourceGroup> -n <vmName> -o json

Will show you all the VM's properties

Upvotes: 1

Related Questions