This documentation is for Octopus Deploy Version 3.13. View other versions

Varying Azure Subscription by Environment

Last updated

You may want to use a different Azure subscription depending on which environment you are targeting. This can be achieved by binding the account field to an Octopus variable:

  1. Add an Azure Subscription Account to Octopus.

    • If you want to use the Account ID in your variable, open the account you just added from Environments ➜ Accounts ➜ [Account Name] and copy the account ID from the URL.

    Account Id
    In the screenshot the account URL is localhost/app#/accounts/azuresubscription-dalmiro-octopusdeploy-com . The Account ID in this case would be azuresubscription-dalmiro-octopusdeploy-com

  2. Create a variable in your project and set the Account ID or Account Name as its value. Make sure to scope this variable to the Environment/Role/Target where you'll be using it.


  3. If you are deploying an Azure Web App, create another variable that holds the name of your App. 

    Azure web app

    Scoped variables

    If you are deploying an Azure Cloud Service, create 2 more variables for the Service and Storage Account names

    Cloud service

    Azure storage

  4. If you are deploying an Azure Web App - On your Azure Web App step use the variables to set the Account and WebApp

    Web app bindings

    If you are deploying an Azure Cloud Service - On your Azure Cloud Service step use the variables to set the Account, Cloud Service and Storage Account

    Cloud service bindings

  5. Once you start the deployment, Octopus will resolve the variables that hold the Account and WebApp/Cloud Service info based on their scope. To use a different account, repeat steps 1-3 and scope the new account variable accordingly.