File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/ALZ/Private/Deploy-Accelerator-Helpers Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,18 @@ function Invoke-Terraform {
2424 )
2525
2626 if ($PSCmdlet.ShouldProcess (" Apply Terraform" , " modify" )) {
27+ # Check and Set Subscription ID
28+ if ($null -eq $env: ARM_SUBSCRIPTION_ID ) {
29+ Write-Verbose " Setting environment variable ARM_SUBSCRIPTION_ID"
30+ $subscriptionId = $ (az account show -- query id - o tsv)
31+ if ($null -eq $subscriptionId -or $subscriptionId -eq " " ) {
32+ Write-Error " Subscription ID not found. Please ensure you are logged in to Azure and have selected a subscription."
33+ return
34+ }
35+ $env: ARM_SUBSCRIPTION_ID = $subscriptionId
36+ Write-Verbose " Environment variable ARM_SUBSCRIPTION_ID set to $subscriptionId "
37+ }
38+
2739 terraform - chdir= " $moduleFolderPath " init
2840 $action = " apply"
2941 if ($destroy ) {
You can’t perform that action at this time.
0 commit comments