Created
September 19, 2019 04:44
-
-
Save gscales/8fe0f836d3ad4687cff850e5ac7d20d6 to your computer and use it in GitHub Desktop.
Key-vault example 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$KeyVaultURL = "https://xxx.vault.azure.net/secrets/App1AuthCert/xxx99c5d054f43698f39c51f24440xxx?api-version=7.0" | |
$SptokenResult = Invoke-WebRequest -Uri 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net' -Headers @{Metadata="true"} | |
$Sptoken = ConvertFrom-Json $SptokenResult.Content | |
$headers = @{ | |
'Content-Type' = 'application\json' | |
'Authorization' = 'Bearer ' + $Sptoken.access_token | |
} | |
$Response = (Invoke-WebRequest -Uri $KeyVaultURL -Headers $headers) | |
$certResponse = ConvertFrom-Json $Response.Content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment