-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from git-for-windows/logging-on-vm-creation-fa…
…ilure Azure self-hosted runners: show logs on failure
- Loading branch information
Showing
3 changed files
with
67 additions
and
33 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Azure Login | ||
description: Logs into Azure using a service principal | ||
inputs: | ||
credentials: | ||
description: Your credentials in JSON format | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Process Azure credentials | ||
uses: actions/github-script@v7 | ||
env: | ||
AZURE_CREDENTIALS: ${{ inputs.credentials }} | ||
with: | ||
script: | | ||
if (!process.env.AZURE_CREDENTIALS) { | ||
core.setFailed('The AZURE_CREDENTIALS secret is required.') | ||
process.exit(1) | ||
} | ||
const azureCredentials = JSON.parse(process.env.AZURE_CREDENTIALS) | ||
const {clientId, clientSecret, tenantId, subscriptionId} = azureCredentials | ||
core.setSecret(clientId) | ||
core.exportVariable('AZURE_CLIENT_ID', clientId) | ||
core.setSecret(clientSecret) | ||
core.exportVariable('AZURE_CLIENT_SECRET', clientSecret) | ||
core.setSecret(tenantId) | ||
core.exportVariable('AZURE_TENANT_ID', tenantId) | ||
core.setSecret(subscriptionId) | ||
core.exportVariable('AZURE_SUBSCRIPTION_ID', subscriptionId) | ||
- name: Azure Login | ||
shell: bash | ||
run: | | ||
echo "Logging into Azure..." | ||
az login --service-principal -u ${{ env.AZURE_CLIENT_ID }} -p ${{ env.AZURE_CLIENT_SECRET }} --tenant ${{ env.AZURE_TENANT_ID }} | ||
echo "Setting subscription..." | ||
az account set --subscription ${{ env.AZURE_SUBSCRIPTION_ID }} --output none |
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 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