Skip to content

appservice/delete-plan/README.md #156

appservice/delete-plan/README.md

appservice/delete-plan/README.md #156

on:
schedule:
- cron: '0 7 * * 4'
workflow_dispatch:
name: 'appservice/delete-plan/README.md'
jobs:
validate:
runs-on: 'ubuntu-latest'
steps:
- uses: 'azure/login@v1'
with:
subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}'
client-id: '${{ secrets.AZURE_CLIENT_ID }}'
tenant-id: '${{ secrets.AZURE_TENANT_ID }}'
- uses: 'actions/checkout@v3'
- run: |
if [[ -z $REGION ]]; then
export REGION=westus
fi
if [[ -z $REGION ]]; then
export REGION=westus
fi
if [[ -z $REGION ]]; then
export REGION=westus
fi
if [[ -z $RESOURCE_GROUP ]]; then
export RESOURCE_GROUP=joazrg-$RANDOM
echo "Using '"$RESOURCE_GROUP"' as resource group"
fi
az group create --name $RESOURCE_GROUP --location $REGION
if [[ -z $APPSERVICE_PLAN ]]; then
export APPSERVICE_PLAN=joazasp-$RANDOM
fi
az appservice plan create \
--resource-group $RESOURCE_GROUP \
--location $REGION \
--name $APPSERVICE_PLAN \
--is-linux \
--sku P1v3
az appservice plan delete \
--resource-group $RESOURCE_GROUP \
--name $APPSERVICE_PLAN \
--yes
export RESULT=$(az appservice plan show --resource-group $RESOURCE_GROUP --name $APPSERVICE_PLAN --query provisioningState --output tsv)
az group delete --name $RESOURCE_GROUP --yes || true
if [[ "$RESULT" == Succeeded ]]; then
exit 1
fi
permissions:
contents: 'read'
id-token: 'write'