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

[BUG]DefaultAzureCredentials is not working #10543

Closed
mymatrixpixel opened this issue Mar 11, 2020 · 8 comments
Closed

[BUG]DefaultAzureCredentials is not working #10543

mymatrixpixel opened this issue Mar 11, 2020 · 8 comments
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.

Comments

@mymatrixpixel
Copy link

Hi Team,

I ave environment variables updated in my Azure VM and have it in .env file along with project.

if i try to access Azure key vault by using below code and keep getting invalid request.

var secretclient = new SecretClient(
new Uri("keyvaulturl"),
new DefaultAzureCredentials()
};

var clientid = await secretclient.GetSecretAsync("someid); //here am keep getting unauthorized- 401 error.

Please let me know, what i am doing wrong.

Thanks

@triage-new-issues triage-new-issues bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Mar 11, 2020
@mymatrixpixel
Copy link
Author

@jongio Can you help?

@jongio
Copy link
Member

jongio commented Mar 11, 2020

@mymatrixpixel
Copy link
Author

Yes, I have access. One more point- i have logged in with different mail id in VS2019. But i whever if i access #ADF i use different mail id and password. So here is my uestion DefaultAzureCredentials will take it from environment system variables or .env file?

@pakrym pakrym added Azure.Identity Client This issue points to a problem in the data-plane of the library. labels Mar 11, 2020
@triage-new-issues triage-new-issues bot removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Mar 11, 2020
@jongio
Copy link
Member

jongio commented Mar 11, 2020

In order to use .env values you have to load the file with DotNetEnv or similar package.

DAC will use env vars, then managed identity, then VS.

If you have multiple accounts then you can set the AZURE_USERNAME env var to the desired account.

@mymatrixpixel
Copy link
Author

I already set the username and password in my VM system variables, but still am facing issue.

@mymatrixpixel
Copy link
Author

mymatrixpixel commented Mar 11, 2020

Error desription below:

service request failed.
status :401 (unauthorized)
message : AKV10032 : invalid issuer. Expected to be one of https://sts.windows.net.

@AlexGhiondea AlexGhiondea added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Mar 11, 2020
@jongio
Copy link
Member

jongio commented Mar 13, 2020

Please try setting the tenant id in AZURE_TENANT_ID that the keyvault is in versus the tenant Id that the SP is in.

@mymatrixpixel
Copy link
Author

@jongio I have fixed the issue. azure key vault is mapped into different tenant I'd. Now am all set and verified its working as expected

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.
Projects
None yet
Development

No branches or pull requests

4 participants