Azure Powershell Version Issue

Inderjit Singh's Avatar

Inderjit Singh

05 Jul, 2017 01:05 AM

I am using the new feature in Azure ARM Templates which allows multi-resource group deployment. To use this new feature we need to use the recent version of Azure Powershell released in June 2017. I am getting a misleading error.

ollowing is the error message I get -Hyak.Common.CloudException: InvalidTemplate: Deployment template validation failed: 'The template resource 'SaveEvenHubSendPolicyToKeyVault' at line '208' and column '10' is invalid. The api-version '2014-04-01-preview' used to deploy the template does not support 'ResourceGroup' property. Please use api-version '2017-05-10' or later to deploy the template. Please see https://aka.ms/arm-template/#resources for usage details.'.

I did update both the templates parent as well as nested template to use "2017-05-10" api version. I also logged onto Octopus Deploy sserver using Remote Desktop and ran the command from Powershell window. I was able to run the tempalte successfully from Powerhsell window but I keep on getting the above error message. My guess is that when I run the deployment through Octo Web interface it is not picking up the right version of Azure Powershell. but that's my theory. I have created a variable fro the porject with the name Octopus.Action.Azure.UseBundledAzurePowerShellModules and set the value to False but I am still getting the error.

I am running out of ideas now. Is this an Octo bug or am I missing something? Please make suggstions.
Thanks,
Inder

  1. 1 Posted by Inderjit Singh on 05 Jul, 2017 02:21 AM

    Inderjit Singh's Avatar

    Just adding some more info to the issue.
    Octopus.Action.Azure.UseBundledAzurePowerShellModules variable was added as a Project Variable. Also I added the following command to one of the project steps and can see the most recent version of Azure Powershell Module for Resource Manager Get-Module -ListAvailable -Name Azure*

  2. 2 Posted by Inderjit Singh on 05 Jul, 2017 03:46 AM

    Inderjit Singh's Avatar

    Just want to write a update on how I implemented a workaround. I switched from using ARM Template Step to Azure Powershell step where I am using New-AzureRmResourceGroupDeployment command explicitly to run the ARM Template and that worked without any problems so at this point it looks like its an Octo Bug.

  3. Support Staff 3 Posted by Mark Siedle on 06 Jul, 2017 12:11 AM

    Mark Siedle's Avatar

    Hi Inderjit,

    Thanks for getting in touch.

    Unfortunately the Octopus.Action.Azure.UseBundledAzurePowerShellModules variable only applies to Octopus' Azure PowerShell steps and not the Azure Resource Group step (as this step uses the Microsoft Management .NET libraries and not PowerShell). We don't believe this is a bug in Octopus as such, but a limitation of the Azure Resource Group step (as this doesn't currenly use PowerShell).

    We have created a GitHub issue here to investigate whether we can safely update to the latest version of these .NET libraries and whether this would fix the problem you're experiencing.

    For now, your workaround of using the Azure PowerShell step to explicitly specify the New-AzureRmResourceGroupDeployment command is a good solution.

    Cheers
    Mark

  4. 4 Posted by Inderjit Singh on 09 Jul, 2017 05:09 AM

    Inderjit Singh's Avatar

    Today I realized that I made a mistake in my workaround of using New-AzureRmResourceGroupDeployment. I specified the incorrect ResourceGroup so that the EventHub was created in the same Resource Group as the KeyVault. Today when I tried creating the Eventhub in the different Resource Group then the KeyVault which is the requirement in my case I am getting failure. Following is the message, please suggest a solution.

    New-AzureRmResourceGroupDeployment : 4:37:35 AM - Error: Code=InvalidTemplate;
    July 8th 2017 23:37:35Error
    Message=Deployment template validation failed: 'The template resource
    July 8th 2017 23:37:35Error
    'SaveEvenHubSendPolicyToKeyVault' at line '208' and column '10' is invalid.
    July 8th 2017 23:37:35Error
    The api-version '2016-02-01' used to deploy the template does not support
    July 8th 2017 23:37:35Error
    'ResourceGroup' property. Please use api-version '2017-05-10' or later to
    July 8th 2017 23:37:35Error
    deploy the template. Please see https://aka.ms/arm-template/#resources for
    July 8th 2017 23:37:35Error
    usage details.'.
    July 8th 2017 23:37:35Error
    At C:\Octopus\Work\20170709043722-2568\src\SentienceTemplates\ParameterFiles\de
    July 8th 2017 23:37:35Error
    vengtsdb01\dev\script.uploadEventHubScriptsToAzureStorage.ps1:63 char:1
    July 8th 2017 23:37:35Error
    + New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupN ...
    July 8th 2017 23:37:35Error
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    July 8th 2017 23:37:35Error
        + CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeplo
    July 8th 2017 23:37:35Error
       yment], Exception
    July 8th 2017 23:37:35Error
        + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets
    July 8th 2017 23:37:35Error
       .Implementation.NewAzureResourceGroupDeploymentCmdlet
    July 8th 2017 23:37:35Error
    July 8th 2017 23:37:36Fatal
    The remote script failed with exit code 1
    July 8th 2017 23:37:36Fatal
    PreDeploymentAndCreateEventhub on the Octopus Server

  5. 5 Posted by Inderjit Singh on 09 Jul, 2017 06:04 AM

    Inderjit Singh's Avatar

    Sorry, please ignore my previous comment. I was provisioning a new environment and did not have Octopus.Action.Azure.UseBundledAzurePowerShellModules variable in the variable set. Once, I added this variable the New-AzureRmResourceGroupDeployment command succeeded.
    Thanks,

  6. 6 Posted by Chris Hudson on 13 Oct, 2017 12:21 PM

    Chris Hudson's Avatar

    Hey, are you going to fix this at some point, that's a really old version of the Azure API.

  7. Support Staff 7 Posted by Mark Siedle on 16 Oct, 2017 01:32 AM

    Mark Siedle's Avatar

    Hi Chris,

    Thanks for getting in touch.

    We agree with you. We have created a GitHub issue here to make sure this gets resolved.

    As a workaround for the time being, you can install the latest version of the Azure PowerShell modules on your server and simply tell Octopus to use them instead (see this documentation for more details).

    Cheers
    Mark

  8. 8 Posted by Chris Hudson on 16 Oct, 2017 05:26 AM

    Chris Hudson's Avatar

    Awesome, thanks for you response. :)

    Get Outlook for Android<https://aka.ms/ghei36>

    ________________________________

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac