tomasrudh / AutoShutdownSchedule

Script intended as Azure automation runbook that automatically starts and stops virtual machines according to tags.
MIT License
18 stars 10 forks source link

Latest version fails due to cross cloud requests #12

Closed hymccord closed 2 years ago

hymccord commented 2 years ago

Describe the bug In the update to use managed identities, if the subscription resides in an environment that is not the Azure public cloud (i.e. azure.com) then the Connect-AzAccount will fail due to a cross cloud request.

For example, I updated the script from 3.6 to 3.8. Our cloud is AzureUSGovernment. (azure.us)

Connect-AzAccount : ClientCertificateCredential authentication failed: AADSTS900382: Confidential Client is not supported in Cross Cloud request.

To Reproduce Run the workbook in a cloud that is not the default public cloud with a system or user-managed identity.

Expected behavior Should work as expected, but you will need to specify environment.

Additional context I will submit a PR shortly to resolve this issue.