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

Support CLI Auth Scoping #7

Closed
syepes opened this issue Dec 30, 2023 · 0 comments · Fixed by #8
Closed

Support CLI Auth Scoping #7

syepes opened this issue Dec 30, 2023 · 0 comments · Fixed by #8

Comments

@syepes
Copy link
Contributor

syepes commented Dec 30, 2023

The CLI Auth method does not correctly handle getting the token with the adequate scope.

When authenticated with the CLI the current token does not allow reading the vault secrets as its not correctly scoped, it generates the following error when trying to get the secrets:

WARN: AKV10022: Invalid audience. Expected https://vault.azure.net, found: https://management.core.windows.net/.

After troubleshooting this issue I found that the get_access_token method would need to handle scoping so the token is generated for the needed API call.

Small hack: Note this fixes the armrest secret show command but breaks the rest as the token is no longer valid for other API calls like resource creation...

command = "az account get-access-token -o json"

Add this just after the above line:

if ENV['ARMREST_VAULT'] || ENV['ARM_VAULT']
  command = command + ' --scope "https://vault.azure.net/.default"'
end
@syepes syepes changed the title Support Auth Scoping Support CLI Auth Scoping Dec 30, 2023
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

Successfully merging a pull request may close this issue.

1 participant