You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$azCliAccount=$(az account show -o json) |ConvertFrom-Json
63
-
if ($azCliAccount) {
64
-
$checkResults+=@{
65
-
message="Azure CLI is logged in. Tenant ID: $($azCliAccount.tenantId), Subscription: $($azCliAccount.name) ($($azCliAccount.id))"
66
-
result="Success"
67
-
}
60
+
if($envVarsSet) {
61
+
Write-InformationColored"Using Service Principal Authentication, skipping Azure CLI checks"-ForegroundColor Yellow -NewLineBefore -InformationAction Continue
68
62
} else {
69
-
$checkResults+=@{
70
-
message="Azure CLI is not logged in. Please login to Azure CLI using 'az login -t `"00000000-0000-0000-0000-000000000000}`"', replacing the empty GUID with your tenant ID."
71
-
result="Failure"
63
+
# Check if Azure CLI is installed
64
+
Write-Verbose"Checking Azure CLI installation"
65
+
$azCliPath=Get-Command az -ErrorAction SilentlyContinue
66
+
if ($azCliPath) {
67
+
$checkResults+=@{
68
+
message="Azure CLI is installed."
69
+
result="Success"
70
+
}
71
+
} else {
72
+
$checkResults+=@{
73
+
message="Azure CLI is not installed. Follow the instructions here: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli"
74
+
result="Failure"
75
+
}
76
+
$hasFailure=$true
77
+
}
78
+
79
+
# Check if Azure CLI is logged in
80
+
Write-Verbose"Checking Azure CLI login status"
81
+
$azCliAccount=$(az account show -o json) |ConvertFrom-Json
82
+
if ($azCliAccount) {
83
+
$checkResults+=@{
84
+
message="Azure CLI is logged in. Tenant ID: $($azCliAccount.tenantId), Subscription: $($azCliAccount.name) ($($azCliAccount.id))"
85
+
result="Success"
86
+
}
87
+
} else {
88
+
$checkResults+=@{
89
+
message="Azure CLI is not logged in. Please login to Azure CLI using 'az login -t `"00000000-0000-0000-0000-000000000000}`"', replacing the empty GUID with your tenant ID."
0 commit comments