Last active
February 4, 2020 12:04
-
-
Save kpatnayakuni/a2df672d5fad5f91c519fb55bcb28541 to your computer and use it in GitHub Desktop.
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
## On the NEW VM in which User Assigned Managed Identity enabled | |
# Enter-PSSession -ComputerName $vmPIP -Credential $credential | |
# Install NuGet package provider where Az module is availble | |
Install-PackageProvider -Name NuGet -Force | |
# Install the Az module | |
Install-Module -Name Az -Force | |
# Login to Azure with managed identity | |
Login-AzAccount -Identity | |
# Get the secret from the Key Vault | |
$kvName = 'testakv99' | |
$keyName = 'sysadmin' | |
$Secret = Get-AzKeyVaultSecret -VaultName $kvName -Name $keyName | % SecretValueText | |
# You can use this secret in your code, since it is a demo I am writing it to screen | |
Write-Host "The password is: $Secret" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment