티스토리 뷰

<현상>

 

PowerShell 포함 PowerShell Core 터미널 창에서 Connect-AzAccount 명령 수행 시, Tenant ID 정보를 인식하지 못하는 현상이 발생했다.

Set-AzContext 명령을 사용하여 구독 정보 변경하려 시도했지만, 유효한 구독 정보를 제공하라는 에러 메시지가 발생한다.

PowerShell 6.2.3
Copyright (c) Microsoft Corporation. All rights reserved.
 
https://aka.ms/pscore6-docs
Type 'help' to get help.
 
PS C:\AzureDevOps-Exercise> Connect-AzAccount
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code HLF5D5FCL to authenticate.
 
Account               SubscriptionName TenantId Environment
-------               ---------------- -------- -----------
zerobig.kim@gmail.com                           AzureCloud
 
PS C:\AzureDevOps-Exercise> Set-AzContext -SubscriptionName "Visual Studio Enterprise 201907"
Set-AzContext : Please provide a valid tenant or a valid subscription.
At line:1 char:1
+ Set-AzContext -SubscriptionName "Visual Studio Enterprise 201907"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [Set-AzContext], ArgumentException

 

 

<해결과정>

 

가용한 AzContext 현황을 조회한다.

PS C:\AzureDevOps-Exercise> Get-AzContext -ListAvailable
 
Name                                     Account                                          SubscriptionName                                 Environment                                      TenantId
----                                     -------                                          ----------------                                 -----------                                      --------
Visual Studio Enterprise (f8764f39-01ee… zerobig.kim@gmail.com                            Visual Studio Enterprise 201907                  AzureCloud                                       917bfe84-0ca6-488d-ad3a-236e41ceafe9
Visual Studio Enterprise (f8764f39-01ee… MSI@50342                                        Visual Studio Enterprise 201907                  AzureCloud                                       917bfe84-0ca6-488d-ad3a-236e41ceafe9
Default                                  zerobig.kim@gmail.com  

 

Clear-AzContext 명령을 수행하여 현재 사용자에 대한 Azure 인증, 계정 및 구독 정보를 초기화한다.

PS C:\AzureDevOps-Exercise> Clear-AzContext -Scope CurrentUser
 
Confirm
Remove all accounts and subscriptions in all sessions for the current user?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y
PS C:\AzureDevOps-Exercise> Get-AzContext -ListAvailable
PS C:\AzureDevOps-Exercise>

 

PowerShell Core 터미널을 새로 열고 Connect-AzAccount를 실행하면 정상적으로 TenantId 값을 인식한다.

PowerShell 6.2.3
Copyright (c) Microsoft Corporation. All rights reserved.
 
https://aka.ms/pscore6-docs
Type 'help' to get help.
 
PS C:\AzureDevOps-Exercise> Get-AzContext -ListAvailable
PS C:\AzureDevOps-Exercise> Connect-AzAccount
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code H4VCFBVNK to authenticate.
 
Account               SubscriptionName                TenantId
-------               ----------------                --------
zerobig.kim@gmail.com Visual Studio Enterprise 201907 917bfe84-xxxx-xxxx-xxxx-236e41c…
 
PS C:\AzureDevOps-Exercise>

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함