|
| 1 | +name: "CI Destroy Resources" |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + azd_environment_name: |
| 6 | + description: "Name of the AZD Environment" |
| 7 | + required: true |
| 8 | + default: "CICD" |
| 9 | + |
| 10 | +permissions: |
| 11 | + id-token: write |
| 12 | + contents: read |
| 13 | + |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + env: |
| 19 | + AZURE_ENV_NAME: ${{ github.event.inputs.azd_environment_name || 'CICD' }} |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout the branch ${{ github.ref_name }} |
| 23 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 24 | + with: |
| 25 | + ref: ${{ github.ref_name }} |
| 26 | + |
| 27 | + - name: Install azd |
| 28 | + uses: Azure/setup-azd@ae0f8b5482eeac61e940f447327d84c73beb8b1e # v2.1.0 |
| 29 | + with: |
| 30 | + version: '1.17.2' # Specify your desired azd version here |
| 31 | + |
| 32 | + - name: Install Terraform |
| 33 | + uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 |
| 34 | + with: |
| 35 | + terraform_version: 1.9.0 |
| 36 | + |
| 37 | + - name: Login to Azure with Federated Identity |
| 38 | + uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0 |
| 39 | + with: |
| 40 | + client-id: ${{ vars.AZURE_CLIENT_ID }} |
| 41 | + tenant-id: ${{ vars.AZURE_TENANT_ID }} |
| 42 | + subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} |
| 43 | + |
| 44 | + - name: Azd down |
| 45 | + env: |
| 46 | + POWER_PLATFORM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} |
| 47 | + POWER_PLATFORM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} |
| 48 | + POWER_PLATFORM_USE_OIDC: "true" |
| 49 | + |
| 50 | + ARM_USE_AZUREAD: "true" |
| 51 | + ARM_STORAGE_USE_AZUREAD: "true" |
| 52 | + ARM_USE_OIDC: "true" |
| 53 | + ARM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} |
| 54 | + ARM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} |
| 55 | + ARM_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} |
| 56 | + AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} |
| 57 | + |
| 58 | + RS_STORAGE_ACCOUNT: ${{ vars.RS_STORAGE_ACCOUNT }} |
| 59 | + RS_CONTAINER_NAME: ${{ vars.RS_CONTAINER_NAME }} |
| 60 | + RS_RESOURCE_GROUP: ${{ vars.RS_RESOURCE_GROUP }} |
| 61 | + RESOURCE_SHARE_USER: ${{ vars.RESOURCE_SHARE_USER }} |
| 62 | + |
| 63 | + shell: bash |
| 64 | + run: | |
| 65 | + azd env set RS_STORAGE_ACCOUNT "$RS_STORAGE_ACCOUNT" |
| 66 | + azd env set RS_CONTAINER_NAME "$RS_CONTAINER_NAME" |
| 67 | + azd env set RS_RESOURCE_GROUP "$RS_RESOURCE_GROUP" |
| 68 | + azd env set RESOURCE_SHARE_USER "$RESOURCE_SHARE_USER" |
| 69 | +
|
| 70 | + azd env select "$AZURE_ENV_NAME" |
| 71 | + azd down --no-prompt --force --purge |
0 commit comments