Create Azure Service Principal account command in Octopus

Azure Service Principal account

Command: New-OctopusAzureServicePrincipalAccount

New-OctopusAzureServicePrincipalAccount allows you to create an Azure Service Principal account in Octopus from within a running deployment

ParametersValue
-nameName for the Azure Service Principal account
-azureSubscriptionGUID Id of the Azure Subscription
-azureApplicationIdGUID Id of the Microsoft Entra ID Application
-azureTenantIdGUID Id of the Microsoft Entra ID Tenant
-azurePasswordMicrosoft Entra ID Password
-azureEnvironmentAzure Environment Identifier, see Azure Environment Options below
-azureBaseUriAzure Base Login URI, see Azure Environment Options below
-azureResourceManagementUriAzure Resource Management URI, see Azure Environment Options below
-updateIfExistingWill update an existing account with the same name, create if it doesn’t exist

Example:

# Targeting the Azure Global Cloud
New-OctopusAzureServicePrincipalAccount -name "My Azure Account" `
                                        -azureSubscription "dea39b53-1ac8-4adc-b291-a44b205921af" `
                                        -azureApplicationId "f83ece42-857d-44ed-9652-0765af7fa7d4" `
                                        -azureTenantId "e91671b4-a676-4cb6-8ff8-69fcb8e048d6" `
                                        -azurePassword "correct horse battery staple" `
                                        -updateIfExisting

# Targeting an isolated Cloud, e.g AzureGermanCloud
New-OctopusAzureServicePrincipalAccount -name "My Azure Account" `
                                        -azureSubscription "dea39b53-1ac8-4adc-b291-a44b205921af" `
                                        -azureApplicationId "f83ece42-857d-44ed-9652-0765af7fa7d4" `
                                        -azureTenantId "e91671b4-a676-4cb6-8ff8-69fcb8e048d6" `
                                        -azurePassword "correct horse battery staple" `
                                        -azureEnvironment "AzureGermanCloud" `
                                        -azureBaseUri "https://login.microsoftonline.de/" `
                                        -azureResourceManagementBaseUri "https://management.microsoftazure.de/"

Azure environment options

The valid options for -azureEnvironment are available via the following command:

Get-AzureRmEnvironment | Select-Object -Property Name,ActiveDirectoryAuthority,ResourceManagerUrl

Valid Azure cloud names are:

  • AzureChina
  • AzureCloud
  • AzureGermanCloud
  • AzureUSGovernment

Help us continuously improve

Please let us know if you have any feedback about this page.

Send feedback

Page updated on Sunday, January 1, 2023

Use Octopus docs with AI