Error message"Changing property 'imageReference' is not allowed."}]}} in Azure Student

Deborah Berube 0 Reputation points
2025-02-10T17:10:31.5+00:00

I am working in Azure Student and trying have created a VM. I am trying to generate ssh keys and keep getting this error: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/815b37e5-b202-482e-90dd-af9ffbf4c6dd/resourceGroups/NewLearner/providers/Microsoft.Resources/deployments/vm_deploy_56edZxBG1RmfMvRzTXd04UIq6DwQKxxS","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"PropertyChangeNotAllowed","target":"imageReference","message":"Changing property 'imageReference' is not allowed."}]}}

I have not changed the Image when setting up my Resource Group or VM. I used the default. I have tried to fix this situation myself but can't get it to work. Can someone help? Thanks!

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,553 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Amira Bedhiafi 30,261 Reputation points
    2025-02-10T22:25:38.23+00:00

    If you are using an ARM template to deploy the VM, verify that the imageReference property is not being modified in subsequent deployments because it must remain consistent with the initial deployment.

    If the VM is not yet in production and you can afford to recreate it, consider deleting the existing VM and deploying a new one with the correct imageReference from the start.

    1. Delete the existing VM.
    2. Make sure that the imageReference in your deployment template or configuration is set correctly.
    3. Redeploy the VM.

    If the issue is related to generating SSH keys, you can use Azure CLI or PowerShell to generate the keys separately and then associate them with your VM.

    az sshkey create --name "mySSHKey" --resource-group "NewLearner"
    
    New-AzSshKey -ResourceGroupName "NewLearner" -Name "mySSHKey"
    
    0 comments No comments

  2. Akshay kumar Mandha 2,670 Reputation points Microsoft External Staff
    2025-02-11T18:23:46.7133333+00:00

    Hi Deborah Berube,
    Based on your latest comment, I understand your query, getting the "Changing property 'imageReference' is not allowed" error while trying to switch from username/password to generating an SSH key. if that is the case, I tested it in my lab, and it worked fine. To fix it, go to the Azure portal, click on "Help," then "Reset password." Make sure to select the correct fields as shown in the image I shared. Once you update, you should get a pop-up to download the key file just save it to a specific location on your machine.
    User's image

    User's image

    Once you've saved the key file to the specified path, use the following command to connect via SSH:

    ssh akshaykey.prem -i linuxwest1@<your public IP>

    For example, it would look something like this:

    ssh akshaykey.prem -i linuxwest1@12.33.344.55

    Just replace <your public IP> with the actual IP address of your server
    User's image

    After login you can see the interface as shown below image

    User's image

    Please let me know if you encounter any issues during the process. I'm always here to assist you as needed.

    If you found this information helpful and my inputs, please click an accepting the answer and "Upvote" on my post for other community members referenceUser's image


Your answer

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