diff --git a/.github/resource/azure-credential-setup.sh b/.github/resource/azure-credential-setup.sh index 42da800..d6b13f3 100644 --- a/.github/resource/azure-credential-setup.sh +++ b/.github/resource/azure-credential-setup.sh @@ -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}" diff --git a/.github/resource/credentials-params.yaml b/.github/resource/credentials-params.yaml index d4b1ed4..dd43290 100644 --- a/.github/resource/credentials-params.yaml +++ b/.github/resource/credentials-params.yaml @@ -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 '' | base64 -w0" to encode the pull secret. +# Run "echo '' | base64 -w0" to encode the pull secret for Linux. +# Run "echo '' | base64" to encode the pull secret for MacOS. - name: PULL_SECRET_ENCODED value: "" description: The base64 encoded pull secret text.