-
Notifications
You must be signed in to change notification settings - Fork 3k
[Identity] Update AzurePowerShellCredential script #41675
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
base: main
Are you sure you want to change the base?
Conversation
- Only add the `-AsSecureString` argument when available and needed. This argument is no longer needed for `Az.Accounts` versions 5.0.0 and above. - Update secure string parsing logic to allow it to work if a user is using Windows PowerShell instead of PowerShell 7+. Signed-off-by: Paul Van Eck <[email protected]>
bca9b0c
to
83c8f09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refines the AzurePowerShellCredential helper by restricting the -AsSecureString
flag to Az.Accounts versions 2.17.0–<5.0.0 and adds a fallback path for parsing SecureString tokens on Windows PowerShell (<7). It also updates the changelog to document this bug fix.
- Limit
-AsSecureString
usage to the intended Az.Accounts version range. - Introduce SecureString-to-plaintext conversion logic for PSVersion < 7.
- Add a changelog entry for the Windows PowerShell compatibility fix.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py | Adjusted version condition and added branch for SecureString parsing |
sdk/identity/azure-identity/CHANGELOG.md | Inserted bug fix entry for Windows PowerShell SecureString support |
Comments suppressed due to low confidence (2)
sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py:51
- This new branch for Windows PowerShell (<7) parsing logic should be covered by automated tests to ensure both PS 7+ and Windows PowerShell behaviors are validated.
if ($PSVersionTable.PSVersion.Major -lt 7) {{
sdk/identity/azure-identity/CHANGELOG.md:11
- Please confirm that
#41675
matches this PR number, and consider also linking the original issue (Update AzurePowerShellCredential for breaking change in Get-AzAccessToken #41508) in the changelog entry for clearer tracking.
- Fixed an issue with `AzurePowerShellCredential` not working correctly for users still using older versions of PowerShell (e.g., Windows PowerShell 5.1) where `-AsPlainText` is not supported in the `ConvertFrom-SecureString` cmdlet. ([#41675](https://github.com/Azure/azure-sdk-for-python/pull/41675))
sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py
Show resolved
Hide resolved
sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py
Outdated
Show resolved
Hide resolved
…powershell.py Co-authored-by: Minh-Anh Phan <[email protected]>
-AsSecureString
argument when available and needed. This argument is no longer needed forAz.Accounts
versions 5.0.0 and above.Closes: #41508