Bilješka
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati da se prijavite ili promijenite direktorije.
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati promijeniti direktorije.
Azure App Configuration is a cloud service that provides a central store for managing application settings. When you use Service Connector to create a service connection, you can store your connection configuration in App Configuration. Storing configuration settings in the App Configuration store naturally supports Infrastructure as Code tools.
In this tutorial, you use Service Connector and App Configuration to do the following tasks in the Azure portal:
- Create a service connection from Azure App Service to App Configuration.
- Create a service connection to Azure Blob Storage and store the configuration in App Configuration.
- View your configuration in App Configuration.
- Use your connection with App Configuration providers.
Prerequisites
- An Azure subscription where you have read and write access to the tutorial resources, in an Azure region that supports Service Connector.
- An Azure App Service app.
- An Azure App Configuration store. Make sure your own user account has App Configuration Data Owner role on the App Configuration store.
- An Azure Blob Storage account. Make sure your own user account has Storage Blob Data Owner/Contributor role on the storage account.
Connect App Service to App Configuration
To store your connection configuration in App Configuration, first connect your App Service app to your App Configuration store.
On the Azure portal page for your App Service app, select Service Connector under Settings in the left navigation menu, and then select Create.
On the Create connection form, complete the following information:
- Service type: Select App Configuration.
- Connection name: Accept the generated connection name, or create a new one that's globally unique in Azure.
- Subscription: Select your subscription if not already selected.
- App Configuration: Select the App Configuration store to use if not already selected.
- Client type: Select your App Service runtime stack if not already selected.
Select Next: Authentication.
On the Authentication tab, select System assigned managed identity.
Select Next: Networking.
On the Networking tab, select Configure firewall rules to enable access to target service.
Note
Because Service Connector writes configuration to App Configuration directly, App Configuration must have public access enabled.
Select Next: Review + Create, and when validation passes, select Create.
It can take some time to create the connection. When the connection is created, its listing appears on the app's Service Connector page.
Connect App Service to Blob Storage and store configuration in App Configuration
Now connect your App Service app to another target service and store the configuration in App Configuration instead of in the app settings. The following example uses Blob Storage. You can follow the same process for other target services.
On the Azure portal page for your App Service app, select Service Connector under Settings in the left navigation menu, and then select Create.
On the Create connection form, complete the following information:
- Service type: Select Storage - Blob.
- Connection name: Accept the generated connection name, or create a new one that's globally unique in Azure.
- Subscription: Select the Blob Storage account subscription if not already selected.
- Storage account: Select the Blob Storage account to use if not already selected.
- Client type: Select your App Service runtime stack if not already selected.
Select Next: Authentication.
On the Authentication tab, select System assigned managed identity.
Select the Store Configuration in App Configuration checkbox.
Under App Configuration Connection, select the App Configuration connection to use.
Select Next: Networking.
On the Networking tab, select Configure firewall rules to enable access to target service.
Select Next: Review + Create, and when validation passes, select Create.
View your configuration in App Configuration
Connections appear on the App Service Service Connector page, where you can view their configurations.
To view service endpoints and values, select the arrow next to a connection to expand it, and then select Hidden value. Click to show value to show the connection value.
To go to a connection's target resource page, select its link in the Resource name column. Select the Resource name link for the App Configuration connection.
On the App Configuration page, select Configuration explorer under Configuration management in the left navigation menu.
On the Configuration explorer page, select the checkbox next to the Blob Storage configuration name, and then select Advanced edit from the top menu bar.
The Advanced edit screen shows the value of the Blob Storage connection.
Use your connection with App Configuration providers
App Configuration supports several providers and client libraries. The following example uses .NET code. For more information, see the Azure App Configuration Kubernetes Provider reference.
using Azure.Identity;
using Azure.Storage.Blobs;
using Microsoft.Extensions.Configuration;
var credential = new ManagedIdentityCredential();
var builder = new ConfigurationBuilder();
builder.AddAzureAppConfiguration(options => options.Connect(new Uri(Environment.GetEnvironmentVariable("AZURE_APPCONFIGURATION_RESOURCEENDPOINT")), credential));
var config = builder.Build();
var storageConnectionName = "UserStorage";
var blobServiceClient = new BlobServiceClient(new Uri(config[$"AZURE_STORAGEBLOB_{storageConnectionName.ToUpperInvariant()}_RESOURCEENDPOINT"]), credential);
Clean up resources
If you no longer need the resources you used in this tutorial, you can delete them individually or by deleting the resource group or groups that contain them.
To delete a resource group, search for and select Resource groups in the Azure portal, select the resource group that contains the resources to delete, and then select Delete on the resource group's page.