You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Apply previous PR feedback
Made previous changes but forgot to push. Found this in my reflog.
* Resolve Key Vault samples issues
Fixes#22913
* Resolve feedback
Copy file name to clipboardExpand all lines: samples/AppSecretsConfig/README.md
+26-11Lines changed: 26 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
---
2
2
page_type: sample
3
3
languages:
4
+
- aspx-csharp
4
5
- csharp
5
6
products:
6
7
- azure
@@ -35,22 +36,31 @@ Examples of secrets that should be stored in Key Vault:
35
36
36
37
To build and run this sample you will need:
37
38
39
+
Software:
40
+
41
+
*[.NET][dotnet_install]
42
+
*[Azure CLI][azure_cli]
43
+
44
+
Azure services:
45
+
38
46
*[App Configuration][appconfig_overview]
39
47
*[Key Vault][keyvault_overview]
48
+
* (Optional) [App Service][appservice_overview] - needed to deploy the web application to Azure, which is provisioned in the [Bicep][bicep_overview][template][sample_template].
40
49
41
-
To deploy this sample you will also need:
50
+
> [!NOTE]
51
+
> App Service has [support for referencing Key Vault secrets][appservice_secrets] directly, but is used only as an example how to configure a web site to use App Configuration.
52
+
> If you choose to deploy your web application to another service, the same principles to configure the App Configuration connection string still apply.
42
53
43
-
*[App Service][appservice_overview]
54
+
*(Optional) [Application Insights][appinsights_overview] - to monitor web traffic and application traces, which is *not* provisioned in the Bicep template.
44
55
45
-
Optionally, you may configure the App Service to use [Application Insights][appinsights_overview] to monitor traffic.
46
-
47
-
[][sample_deploy]
56
+
[][sample_deploy]
48
57
49
58
To deploy the template manually, make sure your [Azure CLI][azure_cli] is up to date and run:
50
59
51
60
```bash
61
+
az bicep install # if deploying azuredeploy.bicep
52
62
az group create --location {location} --resource-group {group-name}
53
-
az deployment group create --resource-group {group-name} --template-file azuredeploy.bicep
63
+
az deployment group create --resource-group {group-name} --template-file azuredeploy.bicep# or azuredeploy.json
54
64
```
55
65
56
66
There are a number of parameters you can optional set. [View the template][sample_template] for details.
@@ -104,7 +114,9 @@ If you're logged in as a service principal, the `user.type` will be `servicePrin
104
114
az keyvault set-policy -n {vault-host-name} --spn {spn} --secret-permissions get
105
115
```
106
116
107
-
#### Visual Studio
117
+
Next you'll need to add the App Configuration connection string from the template deployment outputs to your local user secrets:
118
+
119
+
#### [Visual Studio](#tab/visualstudio)
108
120
109
121
1. Right-click on the project
110
122
2. Click **Managed User Secrets**
@@ -118,7 +130,7 @@ az keyvault set-policy -n {vault-host-name} --spn {spn} --secret-permissions get
118
130
119
131
4. Click **Debug -> Start debugging (F5)** to run.
120
132
121
-
#### Visual Studio Code
133
+
#### [Visual Studio Code](#tab/visualstudiocode)
122
134
123
135
1. In the project folder, run the following to add a variable named `ConnectionStrings:AppConfig` with the `value` of the `appConfigurationConnectionString` output variable:
124
136
@@ -129,7 +141,7 @@ az keyvault set-policy -n {vault-host-name} --spn {spn} --secret-permissions get
129
141
2. With a *.cs* file open the command palette and run `Debug: Start debugging` or press `F5` (default binding).
130
142
3. If prompted, select ".NET Core" to create a launch configuration and start debugging.
131
143
132
-
#### dotnet CLI
144
+
#### [.NET CLI](#tab/dotnet_cli)
133
145
134
146
1. In the project folder, run the following to add a variable named `ConnectionStrings:AppConfig` with the `value` of the `appConfigurationConnectionString` output variable:
135
147
@@ -145,7 +157,7 @@ az keyvault set-policy -n {vault-host-name} --spn {spn} --secret-permissions get
145
157
146
158
#### Deploying the sample
147
159
148
-
See the [ASP.NET quickstart][aspnet_quickstart] for instructions to deploy for Visual Studio, Visual Studio Code, and the `dotnet` CLI. For Visual Studio and Visual Studio Code, make sure you select your existing resource if you deployed the Bicep template above; otherwise, for the `dotnet` CLI you can deploy to an existing resource by [configuring Local Git support][aspnet_deploy_localgit].
160
+
See the [ASP.NET quickstart][aspnet_quickstart] for instructions to deploy for Visual Studio, Visual Studio Code, and the `dotnet` CLI. For Visual Studio and Visual Studio Code, make sure you select your existing resource if you deployed the Bicep template above; otherwise, for the `dotnet` CLI you can deploy to an existing resource by [configuring Git support][aspnet_deploy_localgit] and pushing source, which will be built automatically on the host.
149
161
150
162
## Configuring App Configuration with Key Vault references
151
163
@@ -230,12 +242,15 @@ In [ASP.NET Razor pages][aspnet_razor] as an example, you can then inject them i
0 commit comments