Share via

Disk encryption set troubleshooting

Varshney, Aayushi 0 Reputation points
2025-04-04T16:21:15.0033333+00:00

I am trying to use this command:

$ az vm create --name $VM_NAME --size $VM_SKU --resource-group $RG_NAME --location $RG_LOCATION --image $VM_IMAGE --os-disk-size-gb $VM_OS_DISK --storage-sku Standard_LRS --os-disk-encryption-set $VM_OS_DISK_ENCSET --attach-data-disks $DATA_DISK_NAME --generate-ssh-keys --output json --verbose --admin-username "localadmin" --admin-password $ADMINP --authentication-type "all" --nics $NIC_ID --priority Spot --max-price -1

344Argument '--max-price' is in preview. It may be changed/removed in a future release.

345SSH key files '/root/.ssh/id_rsa' and '/root/.ssh/id_rsa.pub' have been generated under ~/.ssh to allow SSH access to the VM. If using machines without permanent storage, back up your keys to a safe location.

error i am getting:

346Deployment failed. Correlation ID: ####. {

347 "error": {

348 "code": "OperationNotAllowed",

349 "message": "Managed disk encryption set resource id change for disk 'xd####vm1_OsDisk_1_####' via Virtual Machine 'xd####vm1' is not allowed. Please update disk resource at /subscriptions/####/resourceGroups/####/providers/Microsoft.Compute/disks/xd####vm1_OsDisk_####.",

350 "target": "diskEncryptionSets"

351 }

352}

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.


1 answer

Sort by: Most helpful
  1. Sudheer Reddy 2,075 Reputation points Moderator
    2025-04-04T19:38:12.2166667+00:00

    Hi Varshney, Aayushi,

    Based on above command you are trying to specify a Disk Encryption Set to be used for encrypting the OS disk during Virtual Machine creation process as the error indicates the change is not allowed via Virtual Machine.

    First create a VM and then later update an encryption on the disk itself with DES.

    az disk update --name <DiskName> --resource-group <ResourceGroupName> --disk-encryption-set

    https://learn.microsoft.com/en-us/cli/azure/disk?view=azure-cli-latest#az-disk-update

    If the information is helpful, please click on "Upvote"

    If you have any queries, please do let us know, we will help you.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.