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

cli auth scope for vault secrets #8

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/armrest/api/auth/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ def creds
data.deep_transform_keys { |k| k.underscore } # to normalize the structure to the other classes
end

# Looks like az account get-access-token caches the toke in ~/.azure/accessTokens.json
# and will update it only when it expires. So dont think we need to handle caching
# The az cli command itself has it's own caching. So dont think we need to handle caching
def get_access_token
command = "az account get-access-token -o json"
if resource.include?("vault.azure.net")
command += " --scope https://vault.azure.net/.default"
end
logger.debug "command: #{command}"
out = `#{command}`
if $?.success?
Expand Down