Skip to content

Commit 2832ef4

Browse files
committed
Tabbed content experiment
1 parent 3c5d6ea commit 2832ef4

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

articles/azure-app-configuration/quickstart-aspnet-core-app.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Quickstart for Azure App Configuration with ASP.NET Core | Microsoft Docs
33
description: Quickstart for using Azure App Configuration with ASP.NET Core apps
44
services: azure-app-configuration
5-
author: yegu-ms
5+
author: jpconnock
66

77
ms.service: azure-app-configuration
88
ms.devlang: csharp
99
ms.topic: quickstart
10-
ms.date: 12/03/2019
11-
ms.author: yegu
10+
ms.date: 01/04/2020
11+
ms.author: jeconnoc
1212

1313
#Customer intent: As an ASP.NET Core developer, I want to learn how to manage all my app settings in one place.
1414
---
@@ -43,19 +43,24 @@ In this quickstart, you will use Azure App Configuration to centralize storage a
4343

4444
Use the [.NET Core command-line interface (CLI)](https://docs.microsoft.com/dotnet/core/tools/) to create a new ASP.NET Core MVC web app project. The [Azure Cloud Shell](https://shell.azure.com) provides these tools for you. They are also available across the Windows, macOS, and Linux platforms.
4545

46-
1. Create a new folder for your project. For this quickstart, name it *TestAppConfig*.
46+
7. Create a new folder for your project. For this quickstart, name it *TestAppConfig*.
4747

48-
1. In the new folder, run the following command to create a new ASP.NET Core MVC web app project:
48+
8. In the new folder, run the following command to create a new ASP.NET Core MVC web app project:
4949

50-
```CLI
51-
dotnet new mvc --no-https
52-
```
50+
```dotnetcli
51+
dotnet new mvc --no-https
52+
```
5353

5454
## Add Secret Manager
5555

5656
To use Secret Manager, add a `UserSecretsId` element to your *.csproj* file.
5757

58-
- Open the *.csproj* file. Add a `UserSecretsId` element as shown here. You can use the same GUID, or you can replace this value with your own. Save the file.
58+
Open the *.csproj* file. Add a `UserSecretsId` element as shown here. You can use the same GUID, or you can replace this value with your own. Save the file.
59+
60+
> [!IMPORTANT]
61+
> `CreateHostBuilder` replaces `CreateWebHostBuilder` in .NET Core 3.0. Select the correct syntax based on your environment.
62+
63+
#### [.NET Core 2.x](#tab/core2x)
5964

6065
```xml
6166
<Project Sdk="Microsoft.NET.Sdk.Web">
@@ -72,22 +77,27 @@ To use Secret Manager, add a `UserSecretsId` element to your *.csproj* file.
7277

7378
</Project>
7479
```
80+
#### [.NET Core 3.x](#tab/core3x)
81+
82+
This includes a bunch of neat stuff for 3x
83+
84+
---
7585

7686
The Secret Manager tool stores sensitive data for development work outside of your project tree. This approach helps prevent the accidental sharing of app secrets within source code. For more information on Secret Manager, please see [Safe storage of app secrets in development in ASP.NET Core](https://docs.microsoft.com/aspnet/core/security/app-secrets)
7787

7888
## Connect to an App Configuration store
7989

80-
1. Add a reference to the `Microsoft.Azure.AppConfiguration.AspNetCore` NuGet package by running the following command:
90+
9. Add a reference to the `Microsoft.Azure.AppConfiguration.AspNetCore` NuGet package by running the following command:
8191

8292
```CLI
8393
dotnet add package Microsoft.Azure.AppConfiguration.AspNetCore --version 2.0.0-preview-010060003-1250
8494
```
85-
2. Run the following command to restore packages for your project:
95+
10. Run the following command to restore packages for your project:
8696
8797
```CLI
8898
dotnet restore
8999
```
90-
3. Add a secret named *ConnectionStrings:AppConfig* to Secret Manager.
100+
11. Add a secret named *ConnectionStrings:AppConfig* to Secret Manager.
91101
92102
This secret contains the connection string to access your App Configuration store. Replace the value in the following command with the connection string for your App Configuration store.
93103
@@ -104,13 +114,13 @@ The Secret Manager tool stores sensitive data for development work outside of yo
104114
105115
Access this secret using the configuration API. A colon (:) works in the configuration name with the configuration API on all supported platforms. See [Configuration by environment](https://docs.microsoft.com/aspnet/core/fundamentals/configuration/index?tabs=basicconfiguration&view=aspnetcore-2.0).
106116
107-
4. Open *Program.cs*, and add a reference to the .NET Core App Configuration provider.
117+
12. Open *Program.cs*, and add a reference to the .NET Core App Configuration provider.
108118
109119
```csharp
110120
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
111121
```
112122
113-
5. Update the `CreateWebHostBuilder` method to use App Configuration by calling the `config.AddAzureAppConfiguration()` method.
123+
13. Update the `CreateWebHostBuilder` method to use App Configuration by calling the `config.AddAzureAppConfiguration()` method.
114124
115125
> [!IMPORTANT]
116126
> `CreateHostBuilder` replaces `CreateWebHostBuilder` in .NET Core 3.0. Select the correct syntax based on your environment.
@@ -142,7 +152,7 @@ The Secret Manager tool stores sensitive data for development work outside of yo
142152
.UseStartup<Startup>());
143153
```
144154
145-
6. Navigate to *<app root>/Views/Home* and open *Index.cshtml*. Replace its content with the following code:
155+
1. Navigate to *<app root>/Views/Home* and open *Index.cshtml*. Replace its content with the following code:
146156
147157
```HTML
148158
@using Microsoft.Extensions.Configuration
@@ -161,7 +171,7 @@ The Secret Manager tool stores sensitive data for development work outside of yo
161171
<h1>@Configuration["TestApp:Settings:Message"]</h1>
162172
```
163173
164-
7. Navigate to *<app root>/Views/Shared* and open *_Layout.cshtml*. Replace its content with the following code:
174+
14. Navigate to *<app root>/Views/Shared* and open *_Layout.cshtml*. Replace its content with the following code:
165175
166176
```HTML
167177
<!DOCTYPE html>
@@ -190,19 +200,19 @@ The Secret Manager tool stores sensitive data for development work outside of yo
190200
191201
## Build and run the app locally
192202
193-
1. To build the app using the .NET Core CLI, navigate to the root directory of your application and run the following command in the command shell:
203+
15. To build the app using the .NET Core CLI, navigate to the root directory of your application and run the following command in the command shell:
194204
195205
```CLI
196206
dotnet build
197207
```
198208
199-
2. After the build successfully completes, run the following command to run the web app locally:
209+
16. After the build successfully completes, run the following command to run the web app locally:
200210
201211
```CLI
202212
dotnet run
203213
```
204214
205-
3. If you're working on your local machine, use a browser to navigate to `http://localhost:5000`. This is the default URL for the web app hosted locally.
215+
17. If you're working on your local machine, use a browser to navigate to `http://localhost:5000`. This is the default URL for the web app hosted locally.
206216
207217
If you're working in the Azure Cloud Shell, select the *Web Preview* button followed by *Configure*.
208218

0 commit comments

Comments
 (0)