Skip to content

Commit

Permalink
creating workflow to remove environment (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
crgarcia12 authored Jul 5, 2024
1 parent 76976d3 commit 344748d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/marketing-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: '[Marketing Sample] Build sample application'
run-name: '[PR #${{github.event.pull_request.number}}] [Marketing Sample] - Build sample application'
run-name: '[PR #${{github.event.pull_request.number}}] [Marketing Sample] Build sample application'

on:
push:
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/marketing-remove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: '[Marketing Sample] Remove environment'
run-name: '[PR #${{github.event.pull_request.number}}] [Marketing Sample] - Remove environment'

on:
workflow_dispatch:

permissions:
id-token: write
contents: read

defaults:
run:
shell: pwsh
working-directory: ./samples/marketing

jobs:
deployment:
# Environment is going to be used by GitHub to create the subject of the federated identity.
environment: dev

runs-on: ubuntu-latest
env:
AZURE_SUBSCRIPTION_ID: ${{ secrets.MARKETING_AZURE_SUBSCRIPTION_ID }}
AZURE_ENV_NAME: ${{ secrets.MARKETING_AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ secrets.MARKETING_AZURE_LOCATION }}
AZURE_TENANT_ID: ${{ secrets.MARKETING_AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.MARKETING_AZURE_CLIENT_ID }}
# AZURE_CREDENTIALS: ${{ secrets.MARKETING_AZURE_CREDENTIALS }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install azd
uses: Azure/[email protected]

# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Cwindows#use-the-azure-login-action-with-openid-connect
- name: Log in with Azure (Federated Credentials)
if: ${{ env.AZURE_CLIENT_ID != '' }}
run: |
azd auth login `
--client-id "$Env:AZURE_CLIENT_ID" `
--federated-credential-provider "github" `
--tenant-id "$Env:AZURE_TENANT_ID"
- name: Remove Infrastructure
run: |
azd down `
--no-prompt `
--environment ${{ env.AZURE_ENV_NAME }}-sc

0 comments on commit 344748d

Please sign in to comment.