Skip to content

Commit

Permalink
Merge pull request #2400 from sebassem/sp_login_patch
Browse files Browse the repository at this point in the history
ArcBox - Fix bug when SP has access to multiple subscriptions
  • Loading branch information
sebassem authored Feb 7, 2024
2 parents ef46bc4 + 1e03588 commit b2f812d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions azure_jumpstart_arcbox/artifacts/ArcServersLogonScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ if ($Env:flavor -ne "DevOps") {
# Required for CLI commands
Write-Header "Az CLI Login"
az login --service-principal --username $spnClientId --password=$spnClientSecret --tenant $spnTenantId
az account set -s $Env:subscriptionId

# Register Azure providers
Write-Header "Registering Providers"
Expand Down
1 change: 1 addition & 0 deletions azure_jumpstart_arcbox/artifacts/DataOpsLogonScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Connect-AzAccount -Credential $psCred -TenantId $Env:spnTenantId -ServicePrincip
# Required for CLI commands
Write-Header "Az CLI Login"
az login --service-principal --username $Env:spnClientID --password=$Env:spnClientSecret --tenant $Env:spnTenantId
az account set -s $Env:subscriptionId

# Register Azure providers
Write-Header "Registering Providers"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
# Required for CLI commands
Write-Header "Az CLI Login"
az login --service-principal --username $Env:spnClientID --password=$Env:spnClientSecret --tenant $Env:spnTenantId
az account set -s $Env:subscriptionId

# Making extension install dynamic
Write-Header "Installing Azure CLI extensions"
Expand Down
1 change: 1 addition & 0 deletions azure_jumpstart_arcbox/artifacts/DevOpsLogonScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ $Env:capiArcDataClusterName=$Env:capiArcDataClusterName -replace "`n",""
# Required for CLI commands
Write-Header "Az CLI Login"
az login --service-principal --username $Env:spnClientID --password=$Env:spnClientSecret --tenant $Env:spnTenantId
az account set -s $Env:subscriptionId

# Downloading CAPI Kubernetes cluster kubeconfig file
Write-Header "Downloading CAPI K8s Kubeconfig"
Expand Down
1 change: 1 addition & 0 deletions azure_jumpstart_arcbox/artifacts/installCAPI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ sudo -u $adminUsername az extension add --name k8s-extension
echo "Log in to Azure"
sudo -u $adminUsername az login --service-principal --username $SPN_CLIENT_ID --password=$SPN_CLIENT_SECRET --tenant $SPN_TENANT_ID
subscriptionId=$(sudo -u $adminUsername az account show --query id --output tsv)
sudo -u $adminUsername az account set -s $subscriptionId
export AZURE_RESOURCE_GROUP=$(sudo -u $adminUsername az resource list --query "[?name=='$stagingStorageAccountName']".[resourceGroup] --resource-type "Microsoft.Storage/storageAccounts" -o tsv)
az -v
echo ""
Expand Down
2 changes: 2 additions & 0 deletions azure_jumpstart_arcbox/artifacts/installK3s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ sudo -u $adminUsername az extension add --name k8s-extension
echo ""
echo "Log in to Azure"
sudo -u $adminUsername az login --service-principal --username $SPN_CLIENT_ID --password=$SPN_CLIENT_SECRET --tenant $SPN_TENANT_ID
subscriptionId=$(sudo -u $adminUsername az account show --query id --output tsv)
sudo -u $adminUsername az account set -s $subscriptionId
az -v
echo ""

Expand Down

0 comments on commit b2f812d

Please sign in to comment.