-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure OIDC accounts fail authentication when using Az.Accounts module 2.12.5 or later #8504
Comments
Additional workaround: For Az PowerShell Connect-AzAccount -Environment AzureCloud -ApplicationId $OctopusParameters["azure variable name.Client"] -Tenant $OctopusParameters["azure variable name.TenantId"] -Subscription $OctopusParameters["azure variable name.SubscriptionNumber"] -FederatedToken $OctopusParameters["azure variable name.OpenIdConnect.Jwt"] -Scope Process For Az CLI az login --service-principal=$OctopusParameters["azure variable name.SubscriptionNumber"] --username=$OctopusParameters["azure variable name.Client"] --tenant=$OctopusParameters["azure variable name.TenantId"] --federated-token=$OctopusParameters["azure variable name.OpenIdConnect.Jwt"] Also the end of the script should do |
Another report of this (in internal) - https://octopus.zendesk.com/agent/tickets/172067 Having looked at the slack discussion on this (internal - https://octopusdeploy.slack.com/archives/CNHBHV2BX/p1707240979399409) we are currently trying to workout if there is another workaround. |
Hit this issue today unfortunately with our custom worker tools container image using After some digging around, this comment seems to have had its solution implemented upstream in I could be wrong, but this patch appears to be what was proposed above:
Unfortunately that upgrade of
Also linking this reported issue as appears to be identical: OctopusDeploy/WorkerTools#95 |
Hey @OzoneNZ thank you for reaching out, I have informed our engineers of your comment and will let you know what they say. They seem to think this PR from Azure may help fix the issue (along with some tweaks we may have to make once its merged) but since its still in draft form I commented on the Azure issue to see if we could move it along. Will let you know if our engineers have any comments after reading yours, thank you for detailing what you have found! I have seen you have put a support ticket in for this too thank you, I will link it here so we can track all tickets related to this internally - https://octopus.zendesk.com/agent/tickets/197599 (internal link). |
Cheers @Clare-Octopus! At least in my interpretation (and I could be very wrong), that draft PR seems to have been an attempt to more quickly work around the shortcomings of
Crossing my fingers that it is as simple as waiting on an |
I used the latest version of the workertools from Octopus Deploy Labs and it resolved the issue for me: octopuslabs/azure-workertools:2.64.0 |
Can confirm all is working as expected now for us too 👍 |
Severity
Low, workarounds available
Version
2023.4.*
Latest Version
I could reproduce the problem in the latest build
What happened?
When using the Azure PowerShell Modules with Az.Accounts 2.12.2 or later authentication fails at deployment time. This only occurs with Disable-AzAutoContextSave set, we cannot enable this as it would share authentication contexts between subsequent steps and deployments.
This happens across all Azure Steps with variations of the same error message depending on the step.
This issue has been raised with the Azure PowerShell team.
There are other permutations of this issue like Azure/azure-powershell#22480, the move of the Service Principal secrets in 2.13.1 may be related to this issue - Azure/azure-powershell#21593.
Reproduction
Install-Module -Force -Name Az -AllowClobber -Scope AllUsers
Disable-AzContextAutosave
Error and Stacktrace
More Information
There are a number of open issues with the Azure PowerShell team around this problem
Workaround
Use the OctopusDeploy/WorkerTools execution container
Or
Use PowerShell Core
Or
Use earlier versions of the Az.Accounts module, running Install-Module on Az will include the latest version of all other modules Az.Accounts Included. Version
[2.12.3](https://www.powershellgallery.com/packages/Az.Accounts/2.12.3)
and other modules compatible with this are required.The text was updated successfully, but these errors were encountered: