diff --git a/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Clients/KeyVault/KeyVaultClient.cs b/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Clients/KeyVault/KeyVaultClient.cs index 9fa4e8c3b3fcf..4d30c68d59618 100644 --- a/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Clients/KeyVault/KeyVaultClient.cs +++ b/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Clients/KeyVault/KeyVaultClient.cs @@ -92,7 +92,18 @@ internal KeyVaultClient(HttpClient httpClient, NonInteractiveAzureServiceTokenPr byte[] rawCertBytes = Convert.FromBase64String(secretBundle.Value); - X509Certificate2 certificate = new X509Certificate2(rawCertBytes); + X509Certificate2 certificate = null; + + // access to key store dependent on environment, try to import to both user and machine key stores + try + { + certificate = new X509Certificate2(rawCertBytes, default(string), X509KeyStorageFlags.UserKeySet); + } + catch + { + certificate = new X509Certificate2(rawCertBytes, default(string), X509KeyStorageFlags.MachineKeySet); + } + return certificate; } catch (KeyVaultAccessTokenRetrievalException exp) @@ -132,6 +143,7 @@ internal KeyVaultAccessTokenRetrievalException(string message) : { } } + private async Task GetKeyVaultAccessTokenAsync(string secretUrl, CancellationToken cancellationToken) { // Send an anonymous request to Key Vault endpoint to get an OAuth2 HTTP Bearer challenge diff --git a/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Microsoft.Azure.Services.AppAuthentication.csproj b/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Microsoft.Azure.Services.AppAuthentication.csproj index fff77a08fe34f..2ca6085c6114e 100644 --- a/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Microsoft.Azure.Services.AppAuthentication.csproj +++ b/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Microsoft.Azure.Services.AppAuthentication.csproj @@ -2,15 +2,15 @@ Microsoft.Azure.Services.AppAuthentication Enables a service to authenticate to Azure services using the developer's Azure Active Directory/ Microsoft account during development, and authenticate as itself (using OAuth 2.0 Client Credentials flow) when deployed to Azure. - 1.2.1 + 1.3.0 Microsoft.Azure.Services.AppAuthentication Azure Authentication AppAuthentication @@ -22,7 +22,7 @@ - + diff --git a/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Properties/AssemblyInfo.cs b/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Properties/AssemblyInfo.cs index 8d3fa9932c63f..5090aa21c4018 100644 --- a/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Properties/AssemblyInfo.cs +++ b/sdk/mgmtcommon/AppAuthentication/Azure.Services.AppAuthentication/Properties/AssemblyInfo.cs @@ -4,8 +4,8 @@ [assembly: AssemblyTitle("Microsoft.Azure.Services.AppAuthentication")] [assembly: AssemblyDescription("Enables a service to authenticate to Azure services using the developer's Azure Active Directory/ Microsoft account during development, and authenticate as itself (using OAuth 2.0 Client Credentials flow) when deployed to Azure.")] -[assembly: AssemblyVersion("1.2.1.0")] -[assembly: AssemblyFileVersion("1.2.1.0")] +[assembly: AssemblyVersion("1.3.0.0")] +[assembly: AssemblyFileVersion("1.3.0.0")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyProduct("Microsoft Azure")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]