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

Authorization failed message on prepdocs.ps1 #195

Open
mikepugh opened this issue Oct 16, 2023 · 3 comments
Open

Authorization failed message on prepdocs.ps1 #195

mikepugh opened this issue Oct 16, 2023 · 3 comments

Comments

@mikepugh
Copy link

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Set environment variables to existing resources
Run azd auth login
execute .\scripts\prepdocs.ps1

Any log messages given by the failure

Status: 403 (Forbidden)

Content:
{"error":{"code":"","message":"Authorization failed."}}

Headers:
Server: Microsoft-IIS/10.0
Strict-Transport-Security: REDACTED
Preference-Applied: REDACTED
client-request-id: 9...
x-ms-client-request-id: 9...
request-id: 9...
elapsed-time: 11
Date: Mon, 16 Oct 2023 14:37:56 GMT
Content-Length: 55
Content-Type: application/json; charset=utf-8
Content-Language: REDACTED

   at Azure.Search.Documents.IndexesRestClient.ListAsync(String select, CancellationToken cancellationToken)
   at Azure.Search.Documents.Indexes.SearchIndexClient.<>c__DisplayClass58_0.<<GetIndexNamesAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---

Expected/desired behavior

The prepdocs script to execute successfully

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
Windows 10

Versions

azd version 1.4.2 (commit 694107efa395b8562abcdf1f246792bbea72ad9c)

Mention any other details that might be useful

azd auth login does not appear to work to authenticate despite repeated attempts, clearing the ~.azd\auth folder, etc. azd auth login --debug shows no errors and appears to work fine, however my prepdocs script always fails with the above error when the script attempts to lookup the indexes on my cognitive search service.


Thanks! We'll be in touch soon.

@luisquintanilla
Copy link
Collaborator

@mikepugh if you look in your .azure/<env-name>/.env file are all the environment variables set?

I believe these should be the environment variables you'd need for the script to run.

#154 (comment)

@mikepugh
Copy link
Author

Yes the environment variables are all set. Thanks

@Coruscate5
Copy link

FWIW - I had this issue due to tenant permissions settings, being an Owner on the environment objects fixed all the PrepareDocs subproject issues. I think this sample was created assuming you are GA in the tenant, sub owner isn't sufficient for tenant-wide settings like App Registrations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants