|
| 1 | +--- |
| 2 | +title: Create snapshots in App Configuration with Azure Pipelines |
| 3 | +description: Learn to use Azure Pipelines to create a snapshot in an App Configuration Store |
| 4 | +services: azure-app-configuration |
| 5 | +author: MaryanneNjeri |
| 6 | +ms.service: azure-app-configuration |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 09/09/2024 |
| 9 | +ms.author: mgichohi |
| 10 | +--- |
| 11 | + |
| 12 | +# Create snapshots in App Configuration with Azure Pipelines |
| 13 | + |
| 14 | +The Azure App Configuration snapshot task is designed to create snapshots in Azure App Configuration. |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +- Azure subscription - [create one for free](https://azure.microsoft.com/free/) |
| 19 | +- App Configuration store - [create one for free](./quickstart-azure-app-configuration-create.md#create-an-app-configuration-store) |
| 20 | +- Azure DevOps project - [create one for free](https://go.microsoft.com/fwlink/?LinkId=2014881) |
| 21 | +- [Azure Pipelines agent version 2.144.0](https://github.com/microsoft/azure-pipelines-agent/releases/tag/v2.144.0) or later and [Node version 16](https://nodejs.org/en/blog/release/v16.16.0/) or later for running the task on self-hosted agents. |
| 22 | + |
| 23 | +## Create a service connection |
| 24 | + |
| 25 | +[!INCLUDE [azure-app-configuration-service-connection](../../includes/azure-app-configuration-service-connection.md)] |
| 26 | + |
| 27 | +## Add role assignment |
| 28 | + |
| 29 | +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. |
| 30 | + |
| 31 | +1. Go to your target App Configuration store. |
| 32 | +1. In the left menu, select **Access control (IAM)**. |
| 33 | +1. In the right pane, selecte **Add role assignment**. |
| 34 | + |
| 35 | + :::image type="content" border="true" source="./media/azure-app-configuration-role-assignment/add-role-assignment-button.png" alt-text="Screenshot shows the Add role assignments button."::: |
| 36 | +1. For the **Role**, select **App Configuration Data Owner**. This role allows the task to read from and write to the App Configuration store. |
| 37 | +1. Select the service principal associated with the service connection that you created in the previous section. |
| 38 | + |
| 39 | + :::image type="content" border="true" source="./media/azure-app-configuration-role-assignment/add-role-assignment-data-owner.png" alt-text="Screenshot shows the Add role assignment dialog."::: |
| 40 | +1. Select **Review + assign**. |
| 41 | + |
| 42 | +## Use in builds |
| 43 | + |
| 44 | +In this section, learn how to use the Azure App Configuration snapshot task in an Azure DevOps build pipeline. |
| 45 | + |
| 46 | +1. Navigate to the build pipeline page by clicking **Pipelines** > **Pipelines**. For more information about build pipelines got to [Create your first pipeline](/azure/devops/pipelines/create-first-pipeline?tabs=tfs-2018-2). |
| 47 | + - 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. |
| 48 | + > [!div class="mx-imgBorder"] |
| 49 | + >  |
| 50 | + - If you're using an existing build pipeline, click the **Edit** button at the top-right. |
| 51 | + > [!div class="mx-imgBorder"] |
| 52 | + >  |
| 53 | +1. Search for the **Azure App Configuration snapshot** Task. |
| 54 | + > [!div class="mx-imgBorder"] |
| 55 | + >  |
| 56 | +1. 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. |
| 57 | + > [!div class="mx-imgBorder"] |
| 58 | + >  |
| 59 | +1. Save and queue a build. The build log will display any failures that occurred during the execution of the task. |
| 60 | + |
| 61 | +## Use in releases |
| 62 | + |
| 63 | +In this section, learn how to use the Azure App Configuration snapshot task in an Azure DevOps release pipeline. |
| 64 | + |
| 65 | +1. Navigate to the release pipeline page by selecting, **Pipelines** > **Releases**. For more information about release pipelines go to [Create your first pipeline](/azure/devops/pipelines/release). |
| 66 | +1. Choose an existing release pipeline. If you don’t have one, select **+ New** to create a new one. |
| 67 | +1. Select the **Edit** button in the top-right corner to edit the release pipeline. |
| 68 | +1. 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](/azure/devops/pipelines/release/environments). |
| 69 | + > [!div class="mx-imgBorder"] |
| 70 | + >  |
| 71 | +1. Click **+** next to the job to which you want to add a new task. |
| 72 | + > [!div class="mx-imgBorder"] |
| 73 | + >  |
| 74 | +1. In the **Add tasks** dialog, type **Azure App Configuration snapshot** into the search box and select it. |
| 75 | +1. 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. |
| 76 | +1. Save and queue a release. The release log will display any failures encountered during the execution of the task. |
| 77 | + |
| 78 | +## Parameters |
| 79 | + |
| 80 | +The following parameters are used by the App Configuration snapshot task: |
| 81 | + |
| 82 | +- **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. |
| 83 | + |
| 84 | +- **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. |
| 85 | + |
| 86 | +- **Snapshot Name**: Specify the name for the snapshot. |
| 87 | + |
| 88 | +- **Composition Type**: The default value is **Key**. |
| 89 | + - **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. |
| 90 | + |
| 91 | + - **Key-Label**: Filters will be applied and every key-value in the resulting snapshot will be uniquely identified by the key and label together. |
| 92 | + |
| 93 | +- **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. |
| 94 | + |
| 95 | +- **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. |
| 96 | + |
| 97 | +- **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. |
| 98 | + |
| 99 | +## Troubleshooting |
| 100 | + |
| 101 | +If an unexpected error occurs, debug logs can be enabled by setting the pipeline variable `system.debug` to `true`. |
| 102 | + |
| 103 | +## Next step |
| 104 | + |
| 105 | +> [!div class="nextstepaction"] |
| 106 | +> [Pull settings from App Configuration with Azure pipelines](./pull-key-value-devops-pipeline.md) |
0 commit comments