Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Azure Vault Support #1

Closed
kdcllc opened this issue Feb 12, 2019 · 0 comments
Closed

Add Azure Vault Support #1

kdcllc opened this issue Feb 12, 2019 · 0 comments

Comments

@kdcllc
Copy link
Owner

kdcllc commented Feb 12, 2019

Add Azure Vault Key Configuration provider that can be used with MSI and without MSI token provider.

-How to use managed identities for App Service and Azure Functions

-Add method to get an access token

-Using Azure KeyVault to manage secrets of eShopOnContainers

-Connection String Support

Everything can be done thru:

<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.2.0" />

This what the alternative code would look like:

       var kv = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(GetToken));
        configBuilder.AddAzureKeyVault(options.BaseUrl, kv, new DefaultKeyVaultSecretManager());

        public static async Task<string> GetToken(string authority, string resource, string scope)
        {
            var options = Configuration.Bind<AzureVaultOptions>("AzureVault");

            var authContext = new AuthenticationContext(authority);
            ClientCredential clientCred = new ClientCredential(options.ClientId, options.ClientSecret);
            AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientCred);

            if (result == null)
                throw new InvalidOperationException("Failed to obtain the JWT token");

            return result.AccessToken;
        }

Issue of using outside of MSI

Get access token using Microsoft.Azure.Services.AppAuthentication in a container

@kdcllc kdcllc transferred this issue from another repository Feb 19, 2019
@kdcllc kdcllc closed this as completed Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant