Skip to content

Commit

Permalink
Merge pull request #126 from azure-javaee/bugfix_was_834
Browse files Browse the repository at this point in the history
[BugFix]Add MacOS base64 encoding note and role assignment for SP creation.
  • Loading branch information
venunathb authored Sep 19, 2024
2 parents 52426d2 + 2de8bfc commit 47eb15e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/resource/azure-credential-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ AZURE_CREDENTIALS_SP_NAME="sp-${REPO_NAME}-$(date +%s)"
echo "Creating Azure Service Principal with name: $AZURE_CREDENTIALS_SP_NAME"
AZURE_SUBSCRIPTION_ID=$(az account show --query id -o tsv| tr -d '\r\n')
AZURE_CREDENTIALS=$(az ad sp create-for-rbac --name "$AZURE_CREDENTIALS_SP_NAME" --role owner --scopes /subscriptions/"$AZURE_SUBSCRIPTION_ID" --sdk-auth)
echo "Azure Credentials created successfully"
SP_ID=$(az ad sp list --display-name $AZURE_CREDENTIALS_SP_NAME --query [0].id -o tsv)
az rest -m POST \
--uri 'https://graph.microsoft.com/v1.0/directoryRoles/roleTemplateId=9b895d92-2cd3-44c7-9d02-a6ac2d5ea5c3/members/$ref' \
--body "{\"@odata.id\":\"https://graph.microsoft.com/v1.0/directoryObjects/${SP_ID}\"}"

## Set the Azure Credentials as a secret in the repository
gh secret set "AZURE_CREDENTIALS" -b"${AZURE_CREDENTIALS}"
Expand Down
3 changes: 2 additions & 1 deletion .github/resource/credentials-params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
description: User name of GitHub account
# The base64 encoded pull secret text.
# See https://learn.microsoft.com/en-us/azure/openshift/tutorial-create-cluster?WT.mc_id=Portal-fx#get-a-red-hat-pull-secret-optional to obtain the pull secret from the Red Hat OpenShift Cluster Manager website.
# Run "echo '<pull-secret-text>' | base64 -w0" to encode the pull secret.
# Run "echo '<pull-secret-text>' | base64 -w0" to encode the pull secret for Linux.
# Run "echo '<pull-secret-text>' | base64" to encode the pull secret for MacOS.
- name: PULL_SECRET_ENCODED
value: ""
description: The base64 encoded pull secret text.
Expand Down

0 comments on commit 47eb15e

Please sign in to comment.