Issues icon indicating copy to clipboard operation
Issues copied to clipboard

Azure Environment Selection for Azure Subscription Account not populating fields and may break accounts

Open patrick-smergut-octopus opened this issue 1 year ago • 2 comments

Severity

Affects anyone trying to Configure an Isolated Azure Environment connection

Version

2023.4.8196, 2024.2.534, does not exist in 2023.3.13181

Latest Version

None

What happened?

When setting up a new Azure Subscription account in Infrastructure > Accounts, in the Azure Environment section after selecting Configure Isolated Azure Environment connection, the environment drop-down selection doesn't populate with the selected environment, and the AD Endpoint Base Uri remains blank:

AzureEnvironmentNotPopulating

In earlier versions of Octopus (e.g. 2023.3.13181), the environment and AD Endpoint Base Uri are populated:

AzureEnvironmentPopulating

Attempting to Save and Test the account in this state can break the account, and it can't be fixed via the UI.

Reproduction

  1. Go to Infrastructure > Accounts > Add Account > Azure Subscription
  2. Go to Azure Environment section and tick Configure Isolated Azure Environment connection
  3. Select one of the Azure Environments
  4. See that the Azure Environment field doesn't populate, and AD Endpoint Base Uri is blank with the shadow text Select an Azure Environment to be able to edit this field

If this is an existing account, clicking Save and Test or Save in the UI will commit the selection, and the fields can no longer be changed via the UI.

Error and Stacktrace

No response

More Information

Possibly related to: https://github.com/OctopusDeploy/Issues/issues/8509

Workaround

The account can be updated via the API instead of the portal/UI. The URLs to populate the Azure Environment fields can be found at:

https://your_octo_url/api/accounts/azureenvironments

The JSON body for an existing account can be found at:

https://your_octo_url/api/Spaces-##/accounts/

At the bottom of the account JSON body will be the fields that need edited, AzureEnvironment and ActiveDirectoryEndpointBaseUri:

  "AzureEnvironment": "",
  "ResourceManagementEndpointBaseUri": "https://management.azure.com/",
  "ActiveDirectoryEndpointBaseUri": ""

Use either the REST API (e.g. SwaggerUI) to PUT the whole account JSON body with the edited section to accounts/<accountid>. The new section would look something like the following:

  "AzureEnvironment": "AzureCloud",
  "ResourceManagementEndpointBaseUri": "https://management.azure.com/",
  "ActiveDirectoryEndpointBaseUri": "https://login.microsoftonline.com/"

patrick-smergut-octopus avatar Feb 29 '24 01:02 patrick-smergut-octopus

Initially found here [internal]: https://octopus.zendesk.com/agent/tickets/170790

patrick-smergut-octopus avatar Feb 29 '24 01:02 patrick-smergut-octopus

Another user affected (internal) - https://octopus.zendesk.com/agent/tickets/172830

Clare-Octopus avatar Mar 01 '24 15:03 Clare-Octopus