Amit
Amit

Reputation: 26326

How to get Azure Key Vault secret using powershell with certificate auth?

I am including a Powershell startup task on an Azure Worker Role which needs to pull a secret from Azure Key Vault. I would like to use a client certificate to authenticate Key Vault request (cert gets installed on the VM when role comes up).

I took a look at this tutorial on azure documentation, but this needs me to write some C# methods and include bunch of nuget packages. Is there a simpler way?

Upvotes: 1

Views: 8318

Answers (2)

Der_Meister
Der_Meister

Reputation: 5027

See this article: Use Azure PowerShell to create a service principal to access resources

Add-AzureRmAccount -ServicePrincipal -CertificateThumbprint $cert.Thumbprint -ApplicationId $appId -TenantId $tenantId

Upvotes: 1

Aravind
Aravind

Reputation: 4173

It is possible to use powershell to access the keys in Keyvault . use the Get-AzureKeyVaultSecret command to get the values. It has multiple parameters to suit different requirements such as get all secrets, specific secrets etc.

https://msdn.microsoft.com/en-us/library/dn868047.aspx

Details of all the keyvault module commandlets can be found here.

https://msdn.microsoft.com/library/azure/dn868052.aspx

Upvotes: 0

Related Questions