Quantcast
Channel: Azure Management Portal forum
Viewing all articles
Browse latest Browse all 4189

PowerShell connect to tenant id fails

$
0
0
Hello,
I try to login to Azure using the following command "Connect-AzAccount -ServicePrincipal -Credential $cred -Tenant $tenantId". Of course I have defined my params for used variables. But it never accepts my tenant id, it always returns:

Connect-AzAccount : AADSTS90002: Tenant 'd*****-19**-42**-b3**-*********cd' not found. This may happen if there are
no active subscriptions for the tenant. Check with your subscription administrator.
Trace ID: 32a201d6-ccb9-49f0-8c8f-3722ba799000
Correlation ID: 6fbe00c4-c97f-4def-80a8-e2fcc544ef90
Timestamp: 2019-11-06 13:39:43Z
At line:1 char:1
+ Connect-AzAccount -ServicePrincipal -Credential $cred -Tenant $tenant ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Connect-AzAccount], AdalServiceException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

But this tenant ID is definitely ok, I am also able to use AzureRM, that works with this tenant id

$cred = Get-Credential
Login-AzureRmAccount -Credential $cred
Get-AzureRMSubscription
Select-AzureRmSubscription -SubscriptionName d*****-19**-42**-b3**-*********cd

I have to admit that I have registered two subscriptions for this user. The user is definitely Service Administrator for this subscritpion.

any idea what I am doing wrong?

Finally I would like to have a PS Script which starts or stops a VM in Azure.

kind regards,
Dieter

Viewing all articles
Browse latest Browse all 4189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>