Skip to content
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

AzurePowerShellCredential fails to generate token due to deprecation message in Az 12.1.0 #30356

Closed
jalkire opened this issue Jul 9, 2024 · 4 comments · Fixed by #30720
Closed
Assignees
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone

Comments

@jalkire
Copy link

jalkire commented Jul 9, 2024

  • Package Name: @azure/identity
  • Package Version: 4.3.0
  • Operating system: Windows
  • nodejs
    • version: 18.20.4

Describe the bug
Az PowerShell 12.1.0 introduced a deprecation warning about an output change of Get-AzAccessToken to securestring. This message causes the Get-AzAccessToken command in azurePowerShellCredential to fail.

To Reproduce
Steps to reproduce the behavior:

  1. Ensure that you have installed Az 12.1.0
  2. Attempt to use AzurePowerShellCredential to get a token. Minimal repro example:
const { AzurePowerShellCredential } = require('@azure/identity');

async function getToken() {
    const credential = new AzurePowerShellCredential();
    const scope = 'https://management.azure.com/.default';
    try {
        const accessToken = await credential.getToken(scope);
        console.log('Successfully retrieved token');
    } catch (error) {
        console.error('Error getting access token:', error);
    }
}

getToken();
  1. Receive error:

Error getting access token: CredentialUnavailableError: Error: Unable to parse the output of PowerShell. Received output: WARNING: Upcoming breaking changes in the cmdlet 'Get-AzAccessToken' :
The Token property of the output type will be changed from String to SecureString. Add the [-AsSecureString] switch to avoid the impact of this upcoming breaking change.

  • The change is expected to take effect in Az version : '13.0.0'
  • The change is expected to take effect in Az.Accounts version : '4.0.0'
    Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.

Expected behavior
No error. Token acquired successfully.

Additional context
A workaround is to disable the deprecation warning, but @azure/identity will still need to be updated to expect a SecureString before Az 13.0.0 is released.

@github-actions github-actions bot added Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jul 9, 2024
Copy link

github-actions bot commented Jul 9, 2024

@KarishmaGhiya @maorleger

Copy link

github-actions bot commented Jul 9, 2024

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@xirzec
Copy link
Member

xirzec commented Jul 10, 2024

Thank you for the detailed report @jalkire

@KarishmaGhiya
Copy link
Contributor

Currently going the check if other languages too are affected by this. And going to come up with the plan.

@KarishmaGhiya KarishmaGhiya removed the needs-team-attention This issue needs attention from Azure service team or SDK team label Jul 12, 2024
@github-actions github-actions bot added the needs-team-attention This issue needs attention from Azure service team or SDK team label Jul 12, 2024
@KarishmaGhiya KarishmaGhiya added this to the 2024-08 milestone Jul 23, 2024
andykao1213 added a commit that referenced this issue Aug 7, 2024
### Packages impacted by this PR
- @azure-rest/maps-search
- @azure-rest/maps-route
- @azure-rest/maps-render
- @azure-rest/maps-geolocation

### Issues associated with this PR
#29699 

### Describe the problem that is addressed by this PR
1. Migrate the test to federated authentication
2. In the samples, use AAD auth as default authentication method.

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?
NA


### Are there test cases added in this PR? _(If not, why?)_
Yes, changes are made in the `Maps<serviceName>.spec.ts`. Note that
there are some failed pipelines:
1. LRO test in maps-route-rest: Known issue. Maps team has an exist work
item under the internal backlog.
2. `CredentialUnavailableError` in macos environment under
maps-geolocation: Know issue. #30356

### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [x] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [ ] Added a changelog (if necessary)
maorleger added a commit that referenced this issue Aug 12, 2024
…0720)

### Packages impacted by this PR

@azure/identity 

### Issues associated with this PR

Resolves #30356

### Describe the problem that is addressed by this PR

Adds support for the `-AsSecureString` flag for
`AzurePowerShellCredential` in order to support upcoming breaking
changes from Az Pwsh modules in a backwards compat way
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
Development

Successfully merging a pull request may close this issue.

4 participants