azure-keyvault

Azure key vault: access denied

点点圈 提交于 2019-11-27 15:02:54
I have the following code for obtaining a secret from the Azure key vault: public static async Task<string> GetToken(string authority, string resource, string scope) { var authContext = new AuthenticationContext(authority); ClientCredential clientCred = new ClientCredential(...); //app id, app secret AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientCred); if (result == null) throw new InvalidOperationException("Failed to obtain the JWT token"); return result.AccessToken; } public static string GetSecret(string secretName) { KeyVaultClient keyVaultClient = new

How to serialize and deserialize a PFX certificate in Azure Key Vault?

落花浮王杯 提交于 2019-11-27 08:55:14
I have a bunch of strings and pfx certificates, which I want to store in Azure Key vault, where only allowed users/apps will be able to get them. It is not hard to do store a string as a Secret, but how can I serialize a certificate in such way that I could retrieve it and deserialize as an X509Certificate2 object in C#? I tried to store it as a key. Here is the Azure powershell code $securepfxpwd = ConvertTo-SecureString -String 'superSecurePassword' -AsPlainText -Force $key = Add-AzureKeyVaultKey -VaultName 'UltraVault' -Name 'MyCertificate' -KeyFilePath 'D:\Certificates\BlaBla.pfx'

Invalid provider type specified. CryptographicException

故事扮演 提交于 2019-11-27 07:53:03
问题 I am trying to run the script GetAppConfigSettings.ps1 from Microsoft docs help setting up a Key Vault The script contains the following # ********************************************************************************************** # Prep the cert credential data # ********************************************************************************************** $certificateName = "$applicationName" + "cert" $myCertThumbprint = (New-SelfSignedCertificate -Type Custom -Subject "$certificateName"

How do I fix an “Operation 'set' not allowed” error when creating an Azure KeyVault secret programmatically?

余生长醉 提交于 2019-11-27 06:23:43
问题 I'm trying to create an Azure KeyVault secret programmatically using Microsoft. Azure.KeyVault.KeyVaultClient. For my purposes, I am getting my auth token authenticating with a certificate as an Azure AD application. The Azure AD application already has the certificate info in its manifest. My code creates the Azure KeyVault giving "all" permissions to both secrets and keys to the object ID of the Azure AD application. I verify that this happened using Powershell to retrieve the KeyVault and

Azure key vault: access denied

空扰寡人 提交于 2019-11-26 17:47:55
问题 I have the following code for obtaining a secret from the Azure key vault: public static async Task<string> GetToken(string authority, string resource, string scope) { var authContext = new AuthenticationContext(authority); ClientCredential clientCred = new ClientCredential(...); //app id, app secret AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientCred); if (result == null) throw new InvalidOperationException("Failed to obtain the JWT token"); return result

How to serialize and deserialize a PFX certificate in Azure Key Vault?

雨燕双飞 提交于 2019-11-26 14:22:33
问题 I have a bunch of strings and pfx certificates, which I want to store in Azure Key vault, where only allowed users/apps will be able to get them. It is not hard to do store a string as a Secret, but how can I serialize a certificate in such way that I could retrieve it and deserialize as an X509Certificate2 object in C#? I tried to store it as a key. Here is the Azure powershell code $securepfxpwd = ConvertTo-SecureString -String 'superSecurePassword' -AsPlainText -Force $key = Add