About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
powershell_heavy
⚠️
windows_first
⚠️
windows_tools
⚠️
missing_linux_example
Summary:
The documentation demonstrates a strong Windows bias. While it uses Azure CLI for some commands, all shell examples are shown in PowerShell syntax, with variables and prompts (PS /home/user>) that are specific to Windows/PowerShell environments. Key steps for exporting VHDs rely on PowerShell-specific Azure modules (e.g., New-AzureStorageContext, Start-AzureStorageBlobCopy, Get-AzureStorageBlobCopyState) with no Linux/Bash equivalents provided. The documentation also lists Windows images first in tables and examples, and references to Linux images are minimal and not used in walkthroughs.
Recommendations:
- Provide parallel Bash/Linux command examples for all steps, especially for exporting VHDs (e.g., using az storage blob copy start or azcopy).
- Use generic shell variable syntax (e.g., $VAR or VAR=) or show both PowerShell and Bash variable assignments.
- Include Linux/Bash prompt examples (e.g., $ or user@host:~$) alongside PowerShell prompts.
- List both Windows and Linux images equally in tables and examples, and use Linux images in at least one walkthrough.
- Reference and link to Linux/Bash-specific documentation where available.
- Clarify which steps require PowerShell and which can be performed in Bash, and provide guidance for Linux users.
Create pull request
Flagged Code Snippets
PS /home/user> $storageAccountName = "edgeazurevmeus"
PS /home/user> $containerName = "azurevmmp"
PS /home/user> $destBlobName = "newblobmp.vhd"
PS /home/user> $storageAccountKey = "n9sCytWLdTBz0F4Sco9SkPGWp6BJBtf7BJBk79msf1PfxJGQdqSfu6TboZWZ10xyZdc4y+Att08cC9B79jB0YA=="
PS /home/user> $destContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
PS /home/user> Start-AzureStorageBlobCopy -AbsoluteUri $diskAccessSAS -DestContainer $containerName -DestContext $destContext -DestBlob $destBlobName
AccountName: edgeazurevmeus, ContainerName: azurevmmp
Name BlobType Length ContentType LastModified AccessTier SnapshotTime IsDeleted VersionId
---- -------- ------ ----------- ------------ ---------- ------------ --------- ---------
newblobmp.vhd PageBlob -1 2021-06-08 00:50:10Z False
PS /home/user> Get-AzureStorageBlobCopyState –Container $containerName –Context $destContext -Blob $destBlobName
CopyId : 24a1e3f5-886a-490d-9dd7-562bb4acff58
CompletionTime :
Status : Pending
Source : https://md-lfn221fppr2c.blob.core.windows.net/d4tb2hp5ff2q/abcd?sv=2018-03-28&sr=b&si=4f588db1-9aac-44d9-9607-35497cc08a7f
BytesCopied : 696254464
TotalBytes : 136367309312
StatusDescription :
DestinationSnapshotTime :
PS /home/user> Get-AzureStorageBlobCopyState –Container $containerName –Context $destContext -Blob $destBlobName
CopyId : 24a1e3f5-886a-490d-9dd7-562bb4acff58
CompletionTime : 6/8/2021 12:57:26 AM +00:00
Status : Success
Source : https://md-lfn221fppr2c.blob.core.windows.net/d4tb2hp5ff2q/abcd?sv=2018-03-28&sr=b&si=4f588db1-9aac-44d9-9607-35497cc08a7f
BytesCopied : 136367309312
TotalBytes : 136367309312
StatusDescription :
DestinationSnapshotTime :
$urn = <URN of the Marketplace image> #Example: “MicrosoftWindowsServer:WindowsServer:2019-Datacenter:Latest”
$diskName = <disk name> #Name for new disk to be created
$diskRG = <resource group> #Resource group that contains the new disk
$storageAccountName = <destination storage account name>
$containerName = <destination container name>
$destBlobName = <blobname.vhd> #Blob that will be created, including .vhd extension
$storageAccountKey = <storage account key>
#Returns all images of type "Windows Server"
az vm image list --all --publisher "MicrosoftWindowsserver" --offer "WindowsServer"
#Returns all Windows Server 2019 Datacenter images from West US published by Microsoft
az vm image list --all --location "westus" --publisher "MicrosoftWindowsserver" --offer "WindowsServer" --sku "2019-Datacenter"
#Returns all VM images from a publisher
az vm image list --all --publisher "Canonical"
PS /home/user> az vm image list --all --publisher "Canonical" --offer "UbuntuServer" --sku "12.04.4-LTS"
[
{
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "12.04.4-LTS",
"urn": "Canonical:UbuntuServer:12.04.4-LTS:12.04.201402270",
"version": "12.04.201402270"
},
{
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "12.04.4-LTS",
"urn": "Canonical:UbuntuServer:12.04.4-LTS:12.04.201404080",
"version": "12.04.201404080"
},
{
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "12.04.4-LTS",
"urn": "Canonical:UbuntuServer:12.04.4-LTS:12.04.201404280",
"version": "12.04.201404280"
},
{
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "12.04.4-LTS",
"urn": "Canonical:UbuntuServer:12.04.4-LTS:12.04.201405140",
"version": "12.04.201405140"
},
{
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "12.04.4-LTS",
"urn": "Canonical:UbuntuServer:12.04.4-LTS:12.04.201406060",
"version": "12.04.201406060"
},
{
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "12.04.4-LTS",
"urn": "Canonical:UbuntuServer:12.04.4-LTS:12.04.201406190",
"version": "12.04.201406190"
},
{
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "12.04.4-LTS",
"urn": "Canonical:UbuntuServer:12.04.4-LTS:12.04.201407020",
"version": "12.04.201407020"
},
{
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "12.04.4-LTS",
"urn": "Canonical:UbuntuServer:12.04.4-LTS:12.04.201407170",
"version": "12.04.201407170"
}
]
PS /home/user>
az disk create -g $diskRG -n $diskName --image-reference $urn
$sas = az disk grant-access --duration-in-seconds 36000 --access-level Read --name $diskName --resource-group $diskRG
$diskAccessSAS = ($sas | ConvertFrom-Json)[0].accessSas
PS /home/user> $urn = “MicrosoftWindowsServer:WindowsServer:2019-Datacenter:Latest”
PS /home/user> $diskName = "newmanageddisk1"
PS /home/user> $diskRG = "newrgmd1"
PS /home/user> az disk create -g $diskRG -n $diskName --image-reference $urn
{
"burstingEnabled": null,
"creationData": {
"createOption": "FromImage",
"galleryImageReference": null,
"imageReference": {
"id": "/Subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/Providers/Microsoft.Compute/Locations/eastus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2019-Datacenter/Versions/17763.1935.2105080716",
"lun": null
},
"logicalSectorSize": null,
"sourceResourceId": null,
"sourceUniqueId": null,
"sourceUri": null,
"storageAccountId": null,
"uploadSizeBytes": null
},
"diskAccessId": null,
"diskIopsReadOnly": null,
"diskIopsReadWrite": 500,
"diskMBpsReadOnly": null,
"diskMBpsReadWrite": 100,
"diskSizeBytes": 136367308800,
"diskSizeGb": 127,
"diskState": "Unattached",
"encryption": {
"diskEncryptionSetId": null,
"type": "EncryptionAtRestWithPlatformKey"
},
"encryptionSettingsCollection": null,
"extendedLocation": null,
"hyperVGeneration": "V1",
"id": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/newrgmd1/providers/Microsoft.Compute/disks/NewManagedDisk1",
"location": "eastus",
"managedBy": null,
"managedByExtended": null,
"maxShares": null,
"name": "NewManagedDisk1",
"networkAccessPolicy": "AllowAll",
"osType": "Windows",
"propertyUpdatesInProgress": null,
"provisioningState": "Succeeded",
"purchasePlan": null,
"resourceGroup": "newrgmd1",
"securityProfile": null,
"shareInfo": null,
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
},
"supportsHibernation": null,
"tags": {},
"tier": "P10",
"timeCreated": "2021-06-08T00:39:34.205982+00:00",
"type": "Microsoft.Compute/disks",
"uniqueId": "1a649ad4-3b95-471e-89ef-1d2ed1f51525",
"zones": null
}
PS /home/user> $sas = az disk grant-access --duration-in-seconds 36000 --access-level Read --name $diskName --resource-group $diskRG
PS /home/user> $diskAccessSAS = ($sas | ConvertFrom-Json)[0].accessSas
PS /home/user>
$destContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
Start-AzureStorageBlobCopy -AbsoluteUri $diskAccessSAS -DestContainer $containerName -DestContext $destContext -DestBlob $destBlobName
Get-AzureStorageBlobCopyState –Container $containerName –Context $destContext -Blob $destBlobName