Azure PowerShell Scripts

Last updated

You can use all of the features we provide for custom scripts, like using variables, passing parameters, publishing output variables and collecting artifacts.

You can manage your Azure subscription using the Azure PowerShell SDK for the Resource Management (RM) or Service Management (SM) API as part of your deployment process.

These scripts are executed on the Octopus Server and will be pre-authenticated using the selected Azure Account. For information about adding a step to the deployment process, see the add step section.

Refer to this guide for more details, and the impact of choosing the right kind of Azure Account on the Azure SDK that will be available.

Example

This example uses the Service Management API to create a new Staging slot as part of the blue/green deployment sample for Azure Web Apps.

#Remove the staging slot if it exists
Remove-AzureWebsite -Name #{WebSite} -Slot Staging -Force

#Create the staging slot
New-AzureWebsite -Name #{WebSite} -Slot Staging

Bring your own Azure SDK

We bundle a version of the Azure SDKs with Octopus Server so you can start deploying to Azure very quickly. In certain situations you may want (or need) to use a different version of the Azure SDK. Refer to this guide for more details.