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
Copy file name to clipboardExpand all lines: src/KeyVault/KeyVault/Az.KeyVault.Extension/Az.KeyVault.Extension.psm1
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -4,20 +4,30 @@
4
4
functionCheck-SubscriptionLogIn
5
5
{
6
6
param (
7
-
[string] $SubscriptionId,
8
-
[string] $AzKVaultName
7
+
[object] $SubscriptionId,
8
+
[object] $AzKVaultName
9
9
)
10
10
11
+
if("string"-ne$SubscriptionId.GetType().Name)
12
+
{
13
+
throw"The type of SubscriptionId should be string, current is "+$SubscriptionId.GetType().Name +". Please check registration information by 'Get-SecretVault | fl'"
14
+
}
15
+
16
+
if("string"-ne$AzKVaultName.GetType().Name)
17
+
{
18
+
throw"The type of AzKVaultName should be string, current is "+$AzKVaultName.GetType().Name +". Please check registration information by 'Get-SecretVault | fl'"
19
+
}
20
+
11
21
$azContext= Az.Accounts\Get-AzContext
12
-
if (($azContext-eq$null) -or ($azContext.Subscription.Id-ne$SubscriptionId))
22
+
if (($null-eq$azContext) -or ($azContext.Subscription.Id-ne$SubscriptionId))
throw"To use ${AzKVaultName} Azure vault, the current user must be logged into Azure account subscription ${SubscriptionId}. Run 'Connect-AzAccount -SubscriptionId ${SubscriptionId}'."
30
+
throw$_.ToString() +"To use Azure vault named '${AzKVaultName}', please try 'Connect-AzAccount -SubscriptionId {SubscriptionId}' to log into Azure account subscription '${SubscriptionId}'."
0 commit comments