Create snapshots in App Configuration with Azure Pipelines

The Azure App Configuration snapshot task is designed to create snapshots in Azure App Configuration.

Prerequisites

Create a service connection

A service connection gives you access to resources in your Azure subscription from your Azure DevOps project.

  1. In Azure DevOps, go to the project that contains your target pipeline. In the lower-left corner, select Project settings.

  2. Under Pipelines, select Service connections. In the upper-right corner, select New service connection.

  3. In New service connection, select Azure Resource Manager.

    Screenshot shows selecting Azure Resource Manager from the New service connection dropdown list.

  4. In the Authentication method dialog, select Workload identity federation (automatic) to create a new workload identity federation or select Workload identity federation (manual) to use an existing workload identity federation.

  5. Enter your subscription, resource group, and a name for your service connection.

If you created a new service principal, find the name of the service principal assigned to the service connection. You'll add a new role assignment to this service principal in the next step.

  1. Go to Project Settings > Service connections.

  2. Select the new service connection.

  3. Select Manage Service Principal.

  4. Note the value in Display name.

    Screenshot shows the service principal display name.

Add role assignment

Assign the proper App Configuration role assignment to the credentials being used within the task so that the task can access the App Configuration store.

  1. Go to your target App Configuration store.

  2. In the left menu, select Access control (IAM).

  3. In the right pane, select Add role assignment.

    Screenshot shows the Add role assignments button.

  4. For the Role, select App Configuration Data Owner. This role allows the task to read from and write to the App Configuration store.

  5. Select the service principal associated with the service connection that you created in the previous section.

    Screenshot shows the Add role assignment dialog.

  6. Select Review + assign.

Use in builds

In this section, learn how to use the Azure App Configuration snapshot task in an Azure DevOps build pipeline.

  1. Navigate to the build pipeline page by clicking Pipelines > Pipelines. For more information about build pipelines got to Create your first pipeline.
    • If you're creating a new build pipeline, on the last step of the process, on the Review tab, select Show assistant on the right side of the pipeline.

      Screenshot shows the Show assistant button for a new pipeline.

    • If you're using an existing build pipeline, click the Edit button at the top-right.

      Screenshot shows the Edit button for an existing pipeline.

  2. Search for the Azure App Configuration snapshot Task.

    Screenshot shows the Add Task dialog with Azure App Configuration snapshot in search box.

  3. Configure the necessary parameters for the task to create a snapshot in an App Configuration store. Explanations of the parameters are available in the Parameters section below and in tooltips next to each parameter.

    Screenshot shows the app configuration snapshot task parameters.

  4. Save and queue a build. The build log displays any failures that occurred during the execution of the task.

Use in releases

In this section, learn how to use the Azure App Configuration snapshot task in an Azure DevOps release pipeline.

  1. Navigate to the release pipeline page by selecting, Pipelines > Releases. For more information about release pipelines, go to Create your first pipeline.
  2. Choose an existing release pipeline. If you don’t have one, select + New to create a new one.
  3. Select the Edit button in the top-right corner to edit the release pipeline.
  4. From the Tasks dropdown, choose the Stage to which you want to add the task. More information about stages can be found in Add stages, dependencies, & conditions.

    Screenshot shows the selected stage in the Tasks dropdown.

  5. Click + next to the job to which you want to add a new task.

    Screenshot shows the plus button next to the job.

  6. In the Add tasks dialog, type Azure App Configuration snapshot into the search box and select it.
  7. Configure the necessary parameters within the task to create a snapshot within your App Configuration store. Explanations of the parameters are available in the Parameters section below, and in tooltips next to each parameter.
  8. Save and queue a release. The release log displays any failures encountered during the execution of the task.

Parameters

The following parameters are used by the App Configuration snapshot task:

  • Azure subscription: A drop-down containing your available Azure service connections. To update and refresh your list of available Azure service connections, press the Refresh Azure subscription button to the right of the textbox.

  • App Configuration Endpoint: A drop-down that loads your available configuration store endpoints under the selected subscription. To update and refresh your list of available configuration store endpoints, press the Refresh App Configuration Endpoint button to the right of the textbox.

  • Snapshot Name: Specify the name for the snapshot.

  • Composition Type: The default value is Key.

    • Key: The filters are applied in order for this composition type. Each key-value in the snapshot is uniquely identified by the key only. If there are multiple key-values with the same key and multiple labels, only one key-value will be retained based on the last applicable filter.

    • Key-Label: Filters will be applied and every key-value in the resulting snapshot will be uniquely identified by the key and label together.

  • Filters: Represents key and label filter used to build an App Configuration snapshot. Filters should be of a valid JSON format. Example [{"key":"abc*", "label":"1.0.0"}]. At least one filter should be specified and a max of three filters can be specified.

  • Retention period: The default value is 30 days. Refers to the number of days the snapshot will be retained after it's archived. Archived snapshots can be recovered during the retention period.

  • Tags: A JSON object in the format of {"tag1":"val1", "tag2":"val2"}, which defines tags that are added to each snapshot created in your App Configuration store.

Troubleshooting

If an unexpected error occurs, debug logs can be enabled by setting the pipeline variable system.debug to true.

Next step

For a complete reference of the parameters or to use this pipeline task in YAML pipelines, please refer to the following document.

To learn how to export key-values from your App Configuration store and set them as Azure pipeline variables, continue to the following document.

To learn how to import key-values from a configuration file into your App Configuration store, continue to the following document.