-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: script federated credentials for github actions deploy to azure
- Loading branch information
Christian Fosli
committed
Sep 18, 2022
1 parent
7fa5be8
commit 61d0fb4
Showing
3 changed files
with
42 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
printf 'Creating app for dev\n' | ||
#az ad app create --display-name christianfosli/stellerom-dev | ||
sleep 2 | ||
appId="$(az ad app list --display-name christianfosli/stellerom-dev --query [0].appId -o tsv)" | ||
#az ad sp create --id "$appId" | ||
|
||
printf 'Creating federated credentials for GitHub Actions\n' | ||
cat << EOF > creds.json | ||
{ | ||
"name": "github-actions-dev", | ||
"issuer": "https://token.actions.githubusercontent.com", | ||
"subject": "repo:christianfosli/stellerom:environment:Development", | ||
"description": "Deploy to azure from GitHub actions", | ||
"audiences": ["api://AzureADTokenExchange"] | ||
} | ||
EOF | ||
az ad app federated-credential create --id "$appId" --parameters creds.json | ||
|
||
printf 'Creating app for prod\n' | ||
#az ad app create --display-name christianfosli/stellerom-prod | ||
sleep 2 | ||
appId="$(az ad app list --display-name christianfosli/stellerom-prod --query [0].appId -o tsv)" | ||
#az ad sp create --id "$appId" | ||
|
||
printf 'Creating federated credentials for GitHub Actions\n' | ||
cat << EOF > creds.json | ||
{ | ||
"name": "github-actions-prod", | ||
"issuer": "https://token.actions.githubusercontent.com", | ||
"subject": "repo:christianfosli/stellerom:environment:Production", | ||
"description": "Deploy to azure from GitHub actions", | ||
"audiences": ["api://AzureADTokenExchange"] | ||
} | ||
EOF | ||
az ad app federated-credential create --id $appId --parameters creds.json | ||
|
||
printf '!!MANUAL STEP: Assign permissions in Azure portal\n' |