Skip to content

Commit 5062cac

Browse files
authored
Merge pull request #14 from FrankieTF/Dev-updateSDK
Removing old app, updating Key Vault to T2 package.
2 parents d0dd9a0 + 8151862 commit 5062cac

File tree

6 files changed

+10
-140
lines changed

6 files changed

+10
-140
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ This command shows the secret information including the URI. After completing th
103103

104104
Open Program.cs file and update the placeholder <YourKeyVaultName> with the name of your Key Vault that you created in Step 3
105105

106+
106107
#### 7) Run the app
107108
From the main menu of Visual Studio 2017, choose
108109
Debug > Start without Debugging.
@@ -117,7 +118,7 @@ This command shows the secret information including the URI. After completing th
117118
5. Select **Create**.
118119
![Publish](./media/PublishToAzure.gif)
119120

120-
#### 8) Enable Managed Service Identity
121+
#### 9) Enable Managed Service Identity
121122
Azure Key Vault provides a way to securely store credentials and other keys and secrets, but your code needs to authenticate to Key Vault to retrieve them. Managed Service Identity (MSI) makes solving this problem simpler by giving Azure services an automatically managed identity in Azure Active Directory (Azure AD). You can use this identity to authenticate to any service that supports Azure AD authentication, including Key Vault, without having any credentials in your code.
122123

123124
1. Return to the Azure CLI
@@ -130,7 +131,7 @@ az webapp identity assign --name "keyvaultdotnetcorequickstart" --resource-group
130131
>[!NOTE]
131132
>This command is the equivalent of going to the portal and switching **Managed service identity** to **On** in the web application properties.
132133
133-
#### 9) Assign permissions to your application to read secrets from Key Vault
134+
#### 10) Assign permissions to your application to read secrets from Key Vault
134135
1. Return to the Azure CLI
135136
2. Run the following commands by replacing the placeholders
136137
```

akvdotnet/Program.cs

Lines changed: 0 additions & 80 deletions
This file was deleted.

akvdotnet/akvdotnet.csproj

Lines changed: 0 additions & 16 deletions
This file was deleted.

akvdotnet/akvdotnet.sln

Lines changed: 0 additions & 25 deletions
This file was deleted.

key-vault-dotnet-core-quickstart/Program.cs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Threading.Tasks;
1+
using Azure.Identity;
2+
using Azure.Extensions.AspNetCore.Configuration.Secrets;
63
using Microsoft.AspNetCore;
74
using Microsoft.AspNetCore.Hosting;
8-
using Microsoft.Azure.KeyVault;
9-
using Microsoft.Azure.Services.AppAuthentication;
105
using Microsoft.Extensions.Configuration;
11-
using Microsoft.Extensions.Configuration.AzureKeyVault;
12-
using Microsoft.Extensions.Logging;
6+
using System;
137

148
namespace key_vault_dotnet_core_quickstart
159
{
@@ -27,12 +21,7 @@ public static IWebHost BuildWebHost(string[] args) =>
2721
var keyVaultEndpoint = GetKeyVaultEndpoint();
2822
if (!string.IsNullOrEmpty(keyVaultEndpoint))
2923
{
30-
var azureServiceTokenProvider = new AzureServiceTokenProvider();
31-
var keyVaultClient = new KeyVaultClient(
32-
new KeyVaultClient.AuthenticationCallback(
33-
azureServiceTokenProvider.KeyVaultTokenCallback));
34-
builder.AddAzureKeyVault(
35-
keyVaultEndpoint, keyVaultClient, new DefaultKeyVaultSecretManager());
24+
builder.AddAzureKeyVault(new Uri(keyVaultEndpoint), new DefaultAzureCredential(), new KeyVaultSecretManager());
3625
}
3726
}
3827
).UseStartup<Startup>()

key-vault-dotnet-core-quickstart/key-vault-dotnet-core-quickstart.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
<TargetFramework>netcoreapp2.0</TargetFramework>
44
</PropertyGroup>
55
<ItemGroup>
6+
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.0.1" />
7+
<PackageReference Include="Azure.Identity" Version="1.2.3" />
68
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.9" />
7-
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.0" />
8-
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.0.3" />
9+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.8" />
910
</ItemGroup>
1011
<ItemGroup>
1112
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />

0 commit comments

Comments
 (0)