Skip to content

Commit

Permalink
action(cli): use azure/cli@v1 to authenticate
Browse files Browse the repository at this point in the history
  • Loading branch information
autocloudarc committed Jan 9, 2024
1 parent 33cb56d commit db44469
Showing 1 changed file with 42 additions and 35 deletions.
77 changes: 42 additions & 35 deletions exercises-dev/.github/workflows/deploy-az-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ jobs:
- name: Authenticate to Azure with OIDC
uses: Azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# enable-AzPSSession: true

- name: Install Pre-Requisites for Self-Hosted Runner if required
run: |
chmod +x $GITHUB_WORKSPACE/az-scripts/setupSelfHostedRunner.sh
Expand All @@ -75,38 +76,44 @@ jobs:
shell: bash
if: ${{ env.skipSelfHostedSetup == 'true' }}

# https://github.com/Azure/login
- name: deploy
run: |
az upgrade --yes --verbose
az bicep upgrade --verbose
az --version
az account show
az account set --subscription -s ${{ secrets.AZURE_SUBSCRIPTION_ID }}
az stack sub create --name ${{ env.stackname }} --location ${{ env.location }} --template-file ${{ env.templateFile }} --parameters ${{ env.templateParamFile }} --deny-settings-mode none --delete-all --yes --verbose
shell: bash
if: ${{ env.deploy == 'true' }}
uses: azure/CLI@v1
with:
azcliversion: latest
inlineScript: |
az --version
az account show
az account set --subscription -s ${{ secrets.AZURE_SUBSCRIPTION_ID }}
az stack sub create --name ${{ env.stackname }} --location ${{ env.location }} --template-file ${{ env.templateFile }} --parameters ${{ env.templateParamFile }} --deny-settings-mode none --delete-all --yes --verbose
shell: bash
if: ${{ env.deploy == 'true' }}

- name: rollback
run: |
az upgrade --yes --verbose
az bicep upgrade --verbose
az --version
az account show
az account set --subscription -s ${{ secrets.AZURE_SUBSCRIPTION_ID }}
az stack sub delete --name ${{ env.stackname }} --location ${{ env.location }} --yes --verbose
shell: bash
if: ${{ env.rollback == 'true' }}

uses: azure/CLI@v1
with:
azcliversion: latest
inlineScript: |
az upgrade --yes --verbose
az bicep upgrade --verbose
az --version
az account show
az account set --subscription -s ${{ secrets.AZURE_SUBSCRIPTION_ID }}
az stack sub delete --name ${{ env.stackname }} --location ${{ env.location }} --yes --verbose
shell: bash
if: ${{ env.rollback == 'true' }}

- name: deployTemplateSpec
run: |
az upgrade --yes --verbose
az bicep upgrade --verbose
az --version
az account show
az account set --subscription -s ${{ secrets.AZURE_SUBSCRIPTION_ID }}
az ts create --name ${{ env.templateSpecName }} --version ${{ env.templateSpecVersion }} --location ${{ env.location }} --resource-group ${{ env.rgpIacName }} --description ${{ env.templateSpecDescription }} --template-file ${{ env.templateSpecSourceFile }} --yes --verbose
sleep 20
id=$(az ts show --name ${{ env.templateSpecName }} --resource-group ${{ env.rgpIacName }} --version ${{ env.templateSpecVersion }} --query 'id')
az deployment group create --resource-group ${{ env.rgpIacName }} --template-spec $id --parameters ${{ env.templateSpecParamFile }} --verbose
shell: bash
if: ${{ env.deployTemplateSpec == 'true' }}
uses: azure/CLI@v1
with:
azcliversion: latest
inlineScript: |
az --version
az account show
az account set --subscription -s ${{ secrets.AZURE_SUBSCRIPTION_ID }}
az ts create --name ${{ env.templateSpecName }} --version ${{ env.templateSpecVersion }} --location ${{ env.location }} --resource-group ${{ env.rgpIacName }} --description ${{ env.templateSpecDescription }} --template-file ${{ env.templateSpecSourceFile }} --yes --verbose
sleep 20
id=$(az ts show --name ${{ env.templateSpecName }} --resource-group ${{ env.rgpIacName }} --version ${{ env.templateSpecVersion }} --query 'id')
az deployment group create --resource-group ${{ env.rgpIacName }} --template-spec $id --parameters ${{ env.templateSpecParamFile }} --verbose
shell: bash
if: ${{ env.deployTemplateSpec == 'true' }}

0 comments on commit db44469

Please sign in to comment.