Skip to content

Commit 267d29e

Browse files
authored
Merge pull request #269598 from ChenTanyi/main
Add service connector + app configuration store toturial
2 parents d9997fc + c16a8f1 commit 267d29e

File tree

9 files changed

+133
-0
lines changed

9 files changed

+133
-0
lines changed
25.1 KB
Loading
77.2 KB
Loading
36.3 KB
Loading
66.3 KB
Loading
28.5 KB
Loading
66.2 KB
Loading
36.3 KB
Loading

articles/service-connector/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ items:
116116
href: how-to-provide-correct-parameters.md
117117
- name: Store secrets in Key Vault
118118
href: tutorial-portal-key-vault.md
119+
- name: Store configuration in App Configuration
120+
href: tutorial-portal-app-configuration-store.md
119121
- name: Connect a container app to Blob Storage
120122
href: ../container-apps/service-connector.md?bc=%2fazure%2fservice-connector%2fbreadcrumb%2ftoc.json&toc=%2fazure%2fservice-connector%2fTOC.json
121123
- name: Create passwordless connection to database
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
title: Tutorial - Connect Azure services and store configuration in an Azure App Configuration store
3+
description: Tutorial showing how to store your connection configuration in Azure App Configuration using Service Connector
4+
author: chentanyi
5+
ms.author: tanchen
6+
ms.service: service-connector
7+
ms.topic: tutorial
8+
ms.date: 03/20/2024
9+
---
10+
11+
# Quickstart: Connect Azure services and store configuration in an App Configuration store
12+
13+
[Azure App Configuration](../azure-app-configuration/overview.md) is a cloud service that provides a central store for managing application settings. The configuration stored in App Configuration naturally supports Infrastructure as Code tools. When you create a service connection using Service Connector, you can choose to store your connection configuration in a connected App Configuration store. In this tutorial, you'll complete the following tasks using the Azure portal.
14+
15+
> [!div class="checklist"]
16+
> * Create a service connection to Azure App Configuration in Azure App Service
17+
> * Create a service connection to Azure Blob Storage and store configuration in Azure App Configuration
18+
> * View your configuration in App Configuration
19+
> * Use your connection with App Configuration providers
20+
21+
## Prerequisites
22+
23+
To create a service connection and store configuration in Azure App Configuration with Service Connector, you need:
24+
25+
* Basic knowledge of [using Service Connector](./quickstart-portal-app-service-connection.md)
26+
* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free).
27+
* An app hosted on App Service. If you don't have one yet, [create and deploy an app to App Service](../app-service/quickstart-dotnetcore.md)
28+
* An Azure App Configuration store. If you don't have one, [create an Azure App Configuration store](../azure-app-configuration/quickstart-azure-app-configuration-create.md)
29+
* An Azure Blob Storage. If you don't have one, [create an Azure Blob Storage](../storage/blobs/storage-quickstart-blobs-portal.md)
30+
* Read and write access to the App Service, App Configuration and the target service.
31+
32+
## Create an App Configuration connection in App Service
33+
34+
To store your connection configuration in App Configuration, start by connecting your App Service to an App Configuration store.
35+
36+
1. In the Azure portal, type **App Service** in the search menu and select the name of the App Service you want to use from the list.
37+
1. Select **Service Connector** from the left table of contents. Then select **Create**.
38+
1. Select or enter the following settings.
39+
40+
| Setting | Suggested value | Description |
41+
| ------------ | ------- | -------------------------------------------------- |
42+
| **Service type** | App Configuration | Target service type. If you don't have an App Configuration store, [create one](../azure-app-configuration/quickstart-azure-app-configuration-create.md). |
43+
| **Connection name** | Unique name | The connection name that identifies the connection between your App Service and target service. |
44+
| **Subscription** | Subscription of the Azure App Configuration store. | The subscription in which your App Configuration store is created. The default value is the subscription listed for the App Service. |
45+
| **App Configuration** | Your App Configuration name | The target App Configuration you want to connect to. |
46+
| **Client type** | The same app stack on this App Service | The application stack that works with the target service you selected. The default value comes from the App Service runtime stack. |
47+
48+
:::image type="content" source="./media/tutorial-portal-app-configuration-store/app-configuration-create.png" alt-text="Screenshot of the Azure portal, creating App Configuration connection." lightbox="./media/tutorial-portal-app-configuration-store/app-configuration-create.png":::
49+
50+
1. Select **Next: Authentication** to select the authentication type. Then select **System assigned managed identity** to connect your App Configuration.
51+
52+
:::image type="content" source="./media/tutorial-portal-app-configuration-store/app-configuration-authentication.png" alt-text="Screenshot of the Azure portal, selecting App Configuration connection auth.":::
53+
54+
1. Select **Next: Networking** to select the network configuration. Then select **Configure firewall rules to enable access to target service** when your App Configuration is opened to public network by default.
55+
56+
> [!TIP]
57+
> Service Connector will write configuration to App Configuration directly, so you need to enable the App Configuration public access when using this feature.
58+
59+
:::image type="content" source="./media/tutorial-portal-app-configuration-store/app-configuration-network.png" alt-text="Screenshot of the Azure portal, selecting App Configuration connection network.":::
60+
61+
1. Then select **Next: Review + Create** to review the provided information. Select **Create** to create the service connection. It can take one minute to complete the operation.
62+
63+
## Create a Blob Storage connection in App Service and store configuration in App Configuration
64+
65+
Now you can create a service connection to another target service and store configuration in a connected App Configuration instead of app settings. We'll use Blob Storage as an example below. Follow the same process for other target services.
66+
67+
1. In the Azure portal, type **App Service** in the search menu and select the name of the App Service you want to use from the list.
68+
1. Select **Service Connector** from the left table of contents. Then select **Create**.
69+
1. Select or enter the following settings.
70+
71+
| Setting | Suggested value | Description |
72+
| ------------ | ------- | -------------------------------------------------- |
73+
| **Service type** | Storage - Blob | Target service type. If you don't have a Storage Blob container, you can [create one](../storage/blobs/storage-quickstart-blobs-portal.md) or use another service type. |
74+
| **Connection name** | Unique name | The connection name that identifies the connection between your App Service and target service. |
75+
| **Subscription** | One of your subscriptions | The subscription in which your target service is deployed. The target service is the service you want to connect to. The default value is the subscription listed for the App Service. |
76+
| **Storage account** | Your storage account | The target storage account you want to connect to. If you choose a different service type, select the corresponding target service instance. |
77+
| **Client type** | The same app stack on this App Service | The application stack that works with the target service you selected. The default value comes from the App Service runtime stack. |
78+
79+
:::image type="content" source="./media/tutorial-portal-app-configuration-store/storage-create.png" alt-text="Screenshot of the Azure portal, creating Blob Storage connection." lightbox="./media/tutorial-portal-app-configuration-store/storage-create.png":::
80+
81+
1. Select **Next: Authentication** to select the authentication type and select **System assigned managed identity** to connect your storage account.
82+
1. Check **Store Configuration in App Configuration** to let Service Connector store the configuration info into your App Configuration store. Then select one of your App Configuration connections under **App Configuration connection**.
83+
84+
:::image type="content" source="./media/tutorial-portal-app-configuration-store/storage-authentication.png" alt-text="Screenshot of the Azure portal, selecting Blob Storage connection auth.":::
85+
86+
1. Select **Next: Networking** and **Configure firewall rules** to update the firewall allowlist in Storage Account so that your App Service can reach the Storage Account.
87+
88+
:::image type="content" source="./media/tutorial-portal-app-configuration-store/storage-network.png" alt-text="Screenshot of the Azure portal, selecting Blob Storage connection network.":::
89+
90+
1. Then select **Next: Review + Create** to review the provided information.
91+
92+
1. Select **Create** to create the service connection. It might take up to one minute to complete the operation.
93+
94+
## View your configuration in App Configuration
95+
96+
1. Expand the Storage - Blob connection, select **Hidden value. Click to show value**. You can see the value of the configuration from App Configuration store.
97+
98+
1. Select the **Resource name** column of your App Configuration connection. You will be redirected to the App Configuration portal page.
99+
100+
1. Select **Configuration explorer** in the App Configuration left menu, and select the blob storage configuration name.
101+
102+
1. Click **Edit** to show the value of this blob storage connection.
103+
104+
:::image type="content" source="./media/tutorial-portal-app-configuration-store/app-configuration-store-detail.png" alt-text="Screenshot of the Azure portal, reviewing App Configuration Store content." lightbox="./media/tutorial-portal-app-configuration-store/app-configuration-store-detail.png":::
105+
106+
## Use your connection with App Configuration providers
107+
108+
Azure App Configuration supports several providers or client libraries. The example below uses .NET code. For more information, refer to the [Azure App Configuration documentation](../azure-app-configuration/reference-kubernetes-provider.md)
109+
110+
```csharp
111+
using Azure.Identity;
112+
using Azure.Storage.Blobs;
113+
using Microsoft.Extensions.Configuration;
114+
115+
var credential = new ManagedIdentityCredential();
116+
var builder = new ConfigurationBuilder();
117+
builder.AddAzureAppConfiguration(options => options.Connect(new Uri(Environment.GetEnvironmentVariable("AZURE_APPCONFIGURATION_RESOURCEENDPOINT")), credential));
118+
119+
var config = builder.Build();
120+
var storageConnectionName = "UserStorage";
121+
var blobServiceClient = new BlobServiceClient(new Uri(config[$"AZURE_STORAGEBLOB_{storageConnectionName.ToUpperInvariant()}_RESOURCEENDPOINT"]), credential);
122+
```
123+
124+
## Clean up resources
125+
126+
When no longer needed, delete the resource group and all related resources created for this tutorial. To do so, select the resource group or the individual resources you created and select **Delete**.
127+
128+
## Next steps
129+
130+
> [!div class="nextstepaction"]
131+
> [Service Connector internals](./concept-service-connector-internals.md)

0 commit comments

Comments
 (0)