Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheCloudScout/b2fa1f9d056496914dbb7094c1ffde61 to your computer and use it in GitHub Desktop.
Save TheCloudScout/b2fa1f9d056496914dbb7094c1ffde61 to your computer and use it in GitHub Desktop.
# Retrieve all Azure Container Registry credentials
$RegistryCredentials = Get-AzContainerRegistry | Get-AzContainerRegistryCredential
# Convert first password to secure string and store it inside Key Vault as a secret
$RegistryPw1 = ConvertTo-SecureString -string $RegistryCredentials.Password -AsPlainText -Force
Set-AzKeyVaultSecret -VaultName $(KeyVaultName) -Name "RegistryPassword1" -SecretValue $RegistryPw1
# Convert second password to secure string and store it inside Key Vault as a secret
$RegistryPw2 = ConvertTo-SecureString -string $RegistryCredentials.Password2 -AsPlainText -Force
Set-AzKeyVaultSecret -VaultName $(KeyVaultName) -Name "RegistryPassword2" -SecretValue $RegistryPw2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment