Skip to content

Commit cd3fb2b

Browse files
Merge pull request #286619 from cephalin/tomcat-convert
steps for Key Vault secrets
2 parents 0c04e7a + 9b39b73 commit cd3fb2b

11 files changed

+123
-39
lines changed
20.4 KB
Loading
139 KB
Loading
119 KB
Loading
168 KB
Loading
187 KB
Loading
46.8 KB
Loading
90.6 KB
Loading
90.7 KB
Loading

articles/app-service/tutorial-dotnetcore-sqldb-app.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Having issues? Check the [Troubleshooting section](#troubleshooting).
112112

113113
::: zone pivot="azure-portal"
114114

115-
## 1. Create App Service, database, and cache
115+
## 2. Create App Service, database, and cache
116116

117117
In this step, you create the Azure resources. The steps used in this tutorial create a set of secure-by-default resources that include App Service, Azure SQL Database, and Azure Cache. For the creation process, you'll specify:
118118

@@ -176,9 +176,12 @@ Sign in to the [Azure portal](https://portal.azure.com/) and follow these steps
176176

177177
The creation wizard generated the connectivity string for you already as [.NET connection strings](configure-common.md#configure-connection-strings) and [app settings](configure-common.md#configure-app-settings). However, the security best practice is to keep secrets out of App Service completely. You'll move your secrets to key vault and change your app setting to [Key Vault references](app-service-key-vault-references.md) with the help of Service Connectors.
178178

179+
> [!TIP]
180+
> To use passwordless authentication, see [How do I change the SQL Database connection to use a managed identity instead?](#how-do-i-change-the-sql-database-connection-to-use-a-managed-identity-instead)
181+
179182
:::row:::
180183
:::column span="2":::
181-
**Step 1:** In the App Service page,
184+
**Step 1:** In the App Service page:
182185
1. In the left menu, select **Settings > Environment variables > Connection strings**.
183186
1. Select **AZURE_SQL_CONNECTIONSTRING**.
184187
1. In **Add/Edit connection string**, in the **Value** field, find the *Password=* part at the end of the string.
@@ -229,6 +232,7 @@ The creation wizard generated the connectivity string for you already as [.NET c
229232
1. In the App Service page, in the left menu, select **Settings > Service Connector**. There are already two connectors, which the app creation wizard created for you.
230233
1. Select checkbox next to the SQL Database connector, then select **Edit**.
231234
1. Select the **Authentication** tab.
235+
1. In **Password**, paste the password you copied earlier.
232236
1. Select **Store Secret in Key Vault**.
233237
1. Under **Key Vault Connection**, select **Create new**.
234238
A **Create connection** dialog is opened on top of the edit dialog.
@@ -277,7 +281,7 @@ The creation wizard generated the connectivity string for you already as [.NET c
277281
:::row-end:::
278282
:::row:::
279283
:::column span="2":::
280-
**Step 8:** To verify that your changes:
284+
**Step 8:** To verify your changes:
281285
1. From the left menu, select **Environment variables > Connection strings** again.
282286
1. Next to **AZURE_SQL_CONNECTIONSTRING**, select **Show value**. The value should be `@Microsoft.KeyValut(...)`, which means that it's a [key vault reference](app-service-key-vault-references.md) because the secret is now managed in the key vault.
283287
1. To verify the Redis connection string, select the **App setting** tab. Next to **AZURE_REDIS_CONNECTIONSTRING**, select **Show value**. The value should be `@Microsoft.KeyValut(...)` too.
@@ -287,7 +291,7 @@ The creation wizard generated the connectivity string for you already as [.NET c
287291
:::column-end:::
288292
:::row-end:::
289293

290-
## 3. Deploy sample code
294+
## 4. Deploy sample code
291295

292296
In this step, you configure GitHub deployment using GitHub Actions. It's just one of many ways to deploy to App Service, but also a great way to have continuous integration in your deployment process. By default, every `git push` to your GitHub repository kicks off the build and deploy action.
293297

@@ -406,7 +410,7 @@ In this step, you configure GitHub deployment using GitHub Actions. It's just on
406410
:::column-end:::
407411
:::row-end:::
408412

409-
## 4. Generate database schema
413+
## 5. Generate database schema
410414

411415
With the SQL Database protected by the virtual network, the easiest way to run [dotnet database migrations](/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli) is in an SSH session with the App Service container.
412416

@@ -433,7 +437,7 @@ In the SSH session, only changes to files in `/home` can persist beyond app rest
433437

434438
Having issues? Check the [Troubleshooting section](#troubleshooting).
435439

436-
## 5. Browse to the app
440+
## 6. Browse to the app
437441

438442
:::row:::
439443
:::column span="2":::
@@ -458,7 +462,7 @@ Having issues? Check the [Troubleshooting section](#troubleshooting).
458462
> [!TIP]
459463
> The sample application implements the [cache-aside](/azure/architecture/patterns/cache-aside) pattern. When you visit a data view for the second time, or reload the same page after making data changes, **Processing time** in the webpage shows a much faster time because it's loading the data from the cache instead of the database.
460464
461-
## 6. Stream diagnostic logs
465+
## 7. Stream diagnostic logs
462466

463467
Azure App Service captures all messages logged to the console to assist you in diagnosing issues with your application. The sample app outputs console log messages in each of its endpoints to demonstrate this capability.
464468

@@ -481,7 +485,7 @@ Azure App Service captures all messages logged to the console to assist you in d
481485
:::column-end:::
482486
:::row-end:::
483487

484-
## 7. Clean up resources
488+
## 8. Clean up resources
485489

486490
When you're finished, you can delete all of the resources from your Azure subscription by deleting the resource group.
487491

@@ -550,7 +554,7 @@ The dev container already has the [Azure Developer CLI](/azure/developer/azure-d
550554
azd up
551555
```
552556

553-
The `azd up` command takes about 15 minutes to complete (the Redis cache take the most time). It also compiles and deploys your application code, but you'll modify your code later to work with App Service. While it's running, the command provides messages about the provisioning and deployment process, including a link to the deployment in Azure. When it finishes, the command also displays a link to the deploy application.
557+
The `azd up` command takes about 15 minutes to complete (the Redis cache takes the most time). It also compiles and deploys your application code, but you'll modify your code later to work with App Service. While it's running, the command provides messages about the provisioning and deployment process, including a link to the deployment in Azure. When it finishes, the command also displays a link to the deploy application.
554558

555559
This AZD template contains files (*azure.yaml* and the *infra* directory) that generate a secure-by-default architecture with the following Azure resources:
556560

@@ -632,7 +636,7 @@ Before you deploy these changes, you still need to generate a migration bundle.
632636
633637
Having issues? Check the [Troubleshooting section](#troubleshooting).
634638
635-
## 4. Generate database schema
639+
## 5. Generate database schema
636640
637641
With the SQL Database protected by the virtual network, the easiest way to run database migrations is in an SSH session with the App Service container. However, the App Service Linux containers don't have the .NET SDK, so the easiest way to run database migrations is to upload a self-contained migrations bundle.
638642

articles/app-service/tutorial-java-spring-cosmosdb.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Sign in to the [Azure portal](https://portal.azure.com/) and follow these steps
157157
- **App Service**: Represents your app and runs in the App Service plan.
158158
- **Virtual network**: Integrated with the App Service app and isolates back-end network traffic.
159159
- **Azure Cosmos DB**: Accessible only from behind its private endpoint. A database is created for you on the database account.
160+
- **Private endpoints**: Access endpoints for the database server and the Redis cache in the virtual network.
160161
- **Private DNS zones**: Enable DNS resolution of the database server and the Redis cache in the virtual network.
161162
:::column-end:::
162163
:::column:::
@@ -172,7 +173,7 @@ The creation wizard generated the connectivity string for you already as an [app
172173

173174
:::row:::
174175
:::column span="2":::
175-
**Step 1:** In the App Service page,
176+
**Step 1:** In the App Service page:
176177
1. In the left menu, select **Settings > Environment variables**.
177178
1. Next to **AZURE_COSMOS_CONNECTIONSTRING**, select **Show value**.
178179
This connection string lets you connect to the Cosmos DB database secured behind a private endpoint. However, the secret is saved directly in the App Service app, which isn't the best. You'll change this.
@@ -255,7 +256,7 @@ The creation wizard generated the connectivity string for you already as an [app
255256
:::row-end:::
256257
:::row:::
257258
:::column span="2":::
258-
**Step 7:** To verify that you secured the secrets:
259+
**Step 7:** To verify your changes:
259260
1. From the left menu, select **Environment variables** again.
260261
1. Make sure that the app setting **spring.data.mongodb.uri** exists. The default connector generated it for you, and your Spring Boot application already uses the variable.
261262
1. Next to the app setting, select **Show value**. The value should be `@Microsoft.KeyValut(...)`, which means that it's a [key vault reference](app-service-key-vault-references.md) because the secret is now managed in the key vault.
@@ -321,7 +322,7 @@ Like the Tomcat convention, if you want to deploy to the root context of Tomcat,
321322
:::column span="2":::
322323
**Step 5 (Option 1: with GitHub Copilot):**
323324
1. Start a new chat session by selecting the **Chat** view, then selecting **+**.
324-
1. Ask, "*@workspace why do i get the error in GitHub actions: The string 'java21' is not valid SemVer notation for a Java version.*" Copilot might give you an explanation and even give you the link to the workflow file that you need to fix.
325+
1. Ask, "*@workspace Why do I get the error in GitHub actions: The string 'java21' is not valid SemVer notation for a Java version.*" Copilot might give you an explanation and even give you the link to the workflow file that you need to fix.
325326
1. Open *.github/workflows/starter-no-infra_msdocs-spring-cosmosdb-123.yaml* in the explorer and make the suggested fix.
326327
GitHub Copilot doesn't give you the same response every time, you might need to ask more questions to fine-tune its response. For tips, see [What can I do with GitHub Copilot in my codespace?](#what-can-i-do-with-github-copilot-in-my-codespace).
327328
:::column-end:::
@@ -497,7 +498,7 @@ The dev container already has the [Azure Developer CLI](/azure/developer/azure-d
497498
azd up
498499
```
499500

500-
The `azd up` command takes about 15 minutes to complete (the Redis cache take the most time). It also compiles and deploys your application code, but you'll modify your code later to work with App Service. While it's running, the command provides messages about the provisioning and deployment process, including a link to the deployment in Azure. When it finishes, the command also displays a link to the deploy application.
501+
The `azd up` command takes about 15 minutes to complete (the Redis cache takes the most time). It also compiles and deploys your application code, but you'll modify your code later to work with App Service. While it's running, the command provides messages about the provisioning and deployment process, including a link to the deployment in Azure. When it finishes, the command also displays a link to the deploy application.
501502

502503
This AZD template contains files (*azure.yaml* and the *infra* directory) that generate a secure-by-default architecture with the following Azure resources:
503504

@@ -508,6 +509,7 @@ The dev container already has the [Azure Developer CLI](/azure/developer/azure-d
508509
- **Azure Cosmos DB account with MongoDB API**: Accessible only from behind its private endpoint. A database is created for you on the server.
509510
- **Azure Cache for Redis**: Accessible only from within the virtual network.
510511
- **Key vault**: Accessible only from behind its private endpoint. Used to manage secrets for the App Service app.
512+
- **Private endpoints**: Access endpoints for the key vault, the database server, and the Redis cache in the virtual network.
511513
- **Private DNS zones**: Enable DNS resolution of the Cosmos DB database, the Redis cache, and the key vault in the virtual network.
512514
- **Log Analytics workspace**: Acts as the target container for your app to ship its logs, where you can also query the logs.
513515

0 commit comments

Comments
 (0)