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

Missing resource principal output misinterpreted as PowerShell not installed #31998

Closed
elKei24 opened this issue Oct 25, 2022 · 4 comments · Fixed by #32251
Closed

Missing resource principal output misinterpreted as PowerShell not installed #31998

elKei24 opened this issue Oct 25, 2022 · 4 comments · Fixed by #32251
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 Workflow: 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

Comments

@elKei24
Copy link

elKei24 commented Oct 25, 2022

When the AzurePowerShellCredential interprets the output for finding the reason for a failed token retrieval, every output that contains "not found" is interpreted as "Powershell not installed":

bool noPowerShell = output.IndexOf("not found", StringComparison.OrdinalIgnoreCase) != -1 ||

This causes very misleading error messages because "not found" is also output for other error cases, for example:

SharedTokenCacheCredential authentication failed: AADSTS500011: The resource principal named <RESOURCE> was not found in the tenant named <TENANT>. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Oct 25, 2022
@azure-sdk azure-sdk added Azure.Identity Client This issue points to a problem in the data-plane of the library. needs-team-triage Workflow: This issue needs the team to triage. labels Oct 25, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 25, 2022
@jsquire jsquire added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-team-triage Workflow: This issue needs the team to triage. labels Oct 25, 2022
@jsquire
Copy link
Member

jsquire commented Oct 25, 2022

//cc: @christothes

@jsquire
Copy link
Member

jsquire commented Oct 25, 2022

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

@christothes
Copy link
Member

Hi @elKei24 - It appears that this error came from SharedTokenCacheCredential. Did you get this error from AzurePowerShellCredential also?

@christothes christothes added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Oct 25, 2022
@ghost ghost removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Oct 25, 2022
@elKei24
Copy link
Author

elKei24 commented Nov 2, 2022

Hi @elKei24 - It appears that this error came from SharedTokenCacheCredential. Did you get this error from AzurePowerShellCredential also?

Hi @christothes and sorry for the late reply: Yes, this error is from AzurePowerShellCredentials. I extracted it from the output variable in the line I referenced above. The whole output looks like this:

#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">_x001B_[31;1mGet-AzAccessToken: _x000A_</S><S S="Error">_x001B_[36;1mLine |_x000A_</S><S S="Error">_x001B_[36;1m  12 | _x001B_[0m $token = _x001B_[36;1mGet-AzAccessToken -ResourceUrl '<RESOURCE>._x001B_[0m …_x000A_</S><S S="Error">_x001B_[36;1m     | _x001B_[31;1m          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000A_</S><S S="Error">_x001B_[31;1m_x001B_[36;1m     | _x001B_[31;1mSharedTokenCacheCredential authentication failed: AADSTS500011: The resource principal named <RESOURCE> was not found in the tenant named <TENANT>. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant._x000A_</S><S S="Error">Trace ID: 8f28f1c5-b01d-4523-abf2-fba6999a2100_x000A_</S><S S="Error">Correlation ID: 72c93312-60ad-4ca1-9593-f218d77cb2f7_x000A_</S><S S="Error">Timestamp: 2022-11-02 09:20:23Z_x001B_[0m_x000A_</S></Objs>

I guess that the PowerShell command itself uses SharedTokenCacheCredential under the hood.

@ghost ghost added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Nov 2, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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 Workflow: 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
None yet
Development

Successfully merging a pull request may close this issue.

5 participants