.github/workflows/scheduled-azure-teardown.yml #397
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is part of our engineering process to build and maintain this file. | |
# See the README markdown file for further details | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 13 1 * *' # Run at 13:00 on the 1st day of the month | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: mcr.microsoft.com/azure-dev-cli-apps:1.3.0 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# login to run ado commands such provision, deploy, and down | |
- name: Log in with Azure (Client Credentials) | |
if: ${{ env.AZURE_CREDENTIALS != '' }} | |
run: | | |
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable; | |
Write-Host "::add-mask::$($info.clientSecret)" | |
azd login ` | |
--client-id "$($info.clientId)" ` | |
--client-secret "$($info.clientSecret)" ` | |
--tenant-id "$($info.tenantId)" | |
shell: pwsh | |
env: | |
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Create AZD environment | |
# Creating an azd environment so we can set the principal type | |
# https://github.com/Azure/reliable-web-app-pattern-dotnet/issues/241 | |
run: azd env new ${{ secrets.AZURE_ENV_NAME }}scheduled --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} --location ${{ secrets.AZURE_LOCATION2 }} | |
- name: Azure Dev Down | |
continue-on-error: true | |
run: azd down --force --purge --no-prompt | |
env: | |
AZURE_ENV_NAME: ${{ secrets.AZURE_ENV_NAME }}scheduled | |
AZURE_LOCATION: ${{ secrets.AZURE_LOCATION2 }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
# Resource names are reserved for a period of time after deletion - ensure they're purged to keep integration running | |
# https://learn.microsoft.com/azure/azure-app-configuration/faq#why-can-t-i-create-an-app-configuration-store-with-the-same-name-as-one-that-i-just-deleted | |
- name: Purge App Configuration Service | |
continue-on-error: true | |
run: | | |
chmod +x ./infra/deploymentScripts/appConfigSvcPurge.sh | |
./infra/deploymentScripts/appConfigSvcPurge.sh -g ${{ secrets.AZURE_ENV_NAME }}daily2-rg |