none
Azure ARM Deployment VM Creation from Shared Image Gallery Image Errors RRS feed

  • Question

  • Hello, 

    I am new to Azure and working with ARM Templates.  I am facing an issue when trying to do the following.  Here is what I have. 

    - OnPrem VM that has been sysprep'd and configured per the MS Article on things to do before uploading to Azure

    - VHD files copied over to a Storage Account

    - New Managed image created which used the VHD files in the Storage account

    - New Shared Image in the Shared Image Gallery, including the definition and the version. 

    The account I am using is a test one which only has one Subscription but the end goal is to have this process worked out so that we can use it for our other account which has multiple subscriptions (thus using the Shared Image Gallery).  

    In the ARM template I am using the following:

    Variable:

    "galleryLocation": "[resourceId('<subscription id>', '<rg name>', 'Microsoft.Compute/galleries/images/versions', variables('galleryName'), parameters('galleryImageDefinitionName'), parameters('galleryImageVersionName'))]"

    Storage Profile:

            "storageProfile": {
              "imageReference": {
                "id": "[variables('galleryLocation')]"
                }
                },

    The error I get every time is:

    {"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.","details":[{"code":"BadRequest","message":"{\r\n \"error\": {\r\n \"code\": \"InvalidParameter\",\r\n \"message\": \"The value of parameter imageReference.id is invalid.\",\r\n \"target\": \"imageReference.id\"\r\n }\r\n}"}]}

    If I use the test-AzResourceGroupDeployment cmdlet in powershell and pass in the template and param file, it seems to give the same ResourceID as I am seeing in the Shared Image Gallery for the version of the image I am trying to use.  

    If I modify the "galleryLocation" variable to point to the "managed image" vs the "SIG Image" then it seems to work ok.  

    Any thoughts?  Thanks, 

    Andrew

    Wednesday, June 12, 2019 7:03 PM

Answers

  • In case anyone else comes across this issue, I have resolved it switching the apiVersion.  I was using version ‘2017-03-30’ however once I changed to version ‘2019-03-01’ it went through ok without the error.  Thanks, 

    Andrew

    • Marked as answer by DawsonAR Thursday, June 13, 2019 4:43 PM
    Thursday, June 13, 2019 4:43 PM

All replies

  • In case anyone else comes across this issue, I have resolved it switching the apiVersion.  I was using version ‘2017-03-30’ however once I changed to version ‘2019-03-01’ it went through ok without the error.  Thanks, 

    Andrew

    • Marked as answer by DawsonAR Thursday, June 13, 2019 4:43 PM
    Thursday, June 13, 2019 4:43 PM
  • How/where did you change the api version? I'm having the same exact issue...
    Monday, July 1, 2019 7:10 PM
  • In the ARM Template under the Microsoft.Compute/virtualMachines:

    "

          "type": "Microsoft.Compute/virtualMachines",
          "name": "[variables('ServerName')]",
          "apiVersion": "2019-03-01",

    "

    • Proposed as answer by Lucky - MS Wednesday, December 4, 2019 1:17 AM
    Wednesday, July 10, 2019 7:13 PM
  • DawsonAR,

    Thank you! You saved me a lot of time.

    I confirm. Changing it to a newer version (for me it was from 2017-12-01 to 2019-07-01) did the work and my VM is now deploying.

    • Proposed as answer by Lucky - MS Wednesday, December 4, 2019 1:17 AM
    Monday, November 25, 2019 10:15 AM