|
| 1 | +--- |
| 2 | +title: Create Snapshots in App Configuration with Azure Pipelines |
| 3 | +description: Learn to use Azure Pipelines to create a snapshot in 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: maryanne |
| 10 | +--- |
| 11 | + |
| 12 | +# Create Snapshots in App Configuration with Azure Pipelines |
| 13 | + |
| 14 | +The Azure App Configuration Snapshot task creates snapshot in an Azure App Configuration instance. |
| 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."::: alt-text="Screenshot shows the Add role assignments button."::: |
| 40 | +1. Select **Review + assign**. |
| 41 | + |
| 42 | +## Use in builds |
| 43 | + |
| 44 | +This section will cover 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**. Documentation for build pipelines can be found [here](/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. Explanation of the parameters are available in the **Parameters** section below and in tooltips next to each parameter. |
| 57 | + > [!div class="mx-imgBorder"] |
| 58 | + > [!Screenshot show the app configuration snapshot task parameters](./media/azure-app-configuration-snapshot-parameters.png) |
| 59 | +1. Save and queue a build. The build log will display any failures that occured during the execution of the task. |
| 60 | + |
| 61 | +## Use in releases |
| 62 | + |
| 63 | +This section will cover how to use the Azure App Configuration Snapshot task in an Azure Devops release pipeline. |
| 64 | + |
| 65 | +1. Navigate to release pipeline page by selecting, **Pipelines** > **Releases**. Documentation for release pipelines can be found [here](/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 [here](/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 stores endpoint under the selected subscription. To update and refresh your list of available configuration stores endpoint, 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 its 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`. |
0 commit comments