Skip to content

Commit f4147cc

Browse files
committed
Enhance Azure CLI setup: Add secret validation checks and improve authentication verification steps
1 parent 0064785 commit f4147cc

1 file changed

Lines changed: 48 additions & 3 deletions

File tree

‎.github/workflows/copilot-setup-steps.yml‎

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,64 @@ jobs:
2929
- name: Checkout code
3030
uses: actions/checkout@v5
3131

32+
- name: Debug - Check if secrets are accessible
33+
run: |
34+
echo "Checking if secrets are set..."
35+
36+
ERROR_COUNT=0
37+
38+
if [ -z "${{ secrets.ARM_CLIENT_ID }}" ]; then
39+
echo "ERROR: ARM_CLIENT_ID is empty or not set"
40+
ERROR_COUNT=$((ERROR_COUNT + 1))
41+
else
42+
echo "✓ ARM_CLIENT_ID is set"
43+
fi
44+
45+
if [ -z "${{ secrets.ARM_TENANT_ID }}" ]; then
46+
echo "ERROR: ARM_TENANT_ID is empty or not set"
47+
ERROR_COUNT=$((ERROR_COUNT + 1))
48+
else
49+
echo "✓ ARM_TENANT_ID is set"
50+
fi
51+
52+
if [ -z "${{ secrets.ARM_SUBSCRIPTION_ID }}" ]; then
53+
echo "ERROR: ARM_SUBSCRIPTION_ID is empty or not set"
54+
ERROR_COUNT=$((ERROR_COUNT + 1))
55+
else
56+
echo "✓ ARM_SUBSCRIPTION_ID is set"
57+
fi
58+
59+
if [ $ERROR_COUNT -gt 0 ]; then
60+
echo ""
61+
echo "FATAL: $ERROR_COUNT required secret(s) missing."
62+
echo "Please verify secrets are configured in the 'demo' environment."
63+
echo "Go to: Settings → Environments → demo → Environment secrets"
64+
exit 1
65+
fi
66+
67+
echo ""
68+
echo "All required secrets are present. Proceeding with Azure login..."
69+
3270
# Get OIDC token and login to Azure using federated identity
33-
# This happens during setup when we have id-token permission
3471
- name: Azure CLI Login with Federated Identity
3572
uses: azure/login@v2
3673
with:
3774
client-id: ${{ secrets.ARM_CLIENT_ID }}
3875
tenant-id: ${{ secrets.ARM_TENANT_ID }}
3976
subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
77+
enable-AzPSSession: false
4078

41-
- name: Validate Azure Auth Works
79+
- name: Verify and persist Azure authentication
4280
run: |
81+
echo "Verifying Azure authentication..."
4382
az account show
4483
az group list --output table
45-
echo "Azure CLI authentication successful and persisted for Copilot"
84+
85+
# Verify the Azure config directory exists and has auth tokens
86+
ls -la ~/.azure/
87+
88+
echo "Azure CLI authentication successful!"
89+
echo "Auth tokens are cached in ~/.azure/ and will persist for this runner session"
90+
echo "Copilot will use these cached credentials"
4691
az account show
4792
az group list --output table

0 commit comments

Comments
 (0)