问题描述
我运行以下命令:-
PS C:\WINDOWS\system32> Connect-AzureRmAccount
WARNING: Because the Az modules have all the capabilities of AzureRM modules and more,we will retire the AzureRM
modules on 29 February 2024. Learn more about the migration to Az: http://aka.ms/azpsmigrate.
Account SubscriptionName TenantId Environment
------- ---------------- -------- -----------
**.***@****.onmicrosoft.com e***-b4fb-0*** AzureCloud
PS C:\WINDOWS\system32> az login --tenant "c*f"
You have logged in. Now let us find all the subscriptions to which you have access...
[
{
"cloudName": "AzureCloud","id": "b**4","isDefault": true,"name": "Microsoft Azure","state": "Enabled","tenantId": "c**f","user": {
"name": "***@***.onmicrosoft.com","type": "user"
}
}
]
PS C:\WINDOWS\system32> Select-AzureSubscription -Current -SubscriptionId "b**4"
Select-AzureSubscription : The term 'Select-AzureSubscription' is not recognized as the name of a cmdlet,function,script file,or operable program. Check the spelling of the name,or if a path was included,verify that the path is
correct and try again.
At line:1 char:1
+ Select-AzureSubscription -Current -SubscriptionId "b1597bc1-913e-4da7 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Select-AzureSubscription:String) [],CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
但我收到上述错误有什么建议吗? 谢谢
编辑
我运行这个命令:-
az login --tenant "c*f"
我得到了这个结果
You have logged in. Now let us find all the subscriptions to which you have access...
[
{
"cloudName": "AzureCloud","type": "user"
}
}
]
但是当我运行这个命令时:-
Select-AzureRmSubscription -Subscription "b**4" -Tenant "c**f"
我得到了这个结果
WARNING: Because the Az modules have all the capabilities of AzureRM modules and more,we will retire the AzureRM
modules on 29 February 2024. Learn more about the migration to Az: http://aka.ms/azpsmigrate.
Select-AzureRmSubscription : Please provide a valid tenant or a valid subscription.
At line:1 char:1
+ Select-AzureRmSubscription -Subscription "b ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureRmContext],ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.SetAzureRMContextCommand
EDIT-2
我试过这个命令:-
PS C:\WINDOWS\system32> Get-AzureRmSubscription -Subscription "b**4" -Tenant "c**f"
但我收到此错误:-
Get-AzureRmSubscription : Parameter cannot be processed because the parameter name 'Subscription' is ambiguous.
Possible matches include: -SubscriptionId -SubscriptionName.
At line:1 char:25
+ Get-AzureRmSubscription -Subscription "b1597bc1-913e-4da7-a020-be3029 ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzureRmSubscription],ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameter,Microsoft.Azure.Commands.Profile.GetAzureRMSubscriptionCommand
所以我运行这个命令:-
PS C:\WINDOWS\system32> Get-AzureRmSubscription -SubscriptionId "b**4" -Tenant "c**f"
但是得到这个错误:-
WARNING: Because the Az modules have all the capabilities of AzureRM modules and more,we will retire the AzureRM
modules on 29 February 2024. Learn more about the migration to Az: http://aka.ms/azpsmigrate.
WARNING: Unable to acquire token for tenant 'cfcab407-f59a-4db4-aec9-d5d3676d708f'
Get-AzureRmSubscription : Subscription b1597bc1-913e-4da7-a020-be30291a6494 was not found in tenant
cfcab407-f59a-4db4-aec9-d5d3676d708f. Please verify that the subscription exists in this tenant.
At line:1 char:1
+ Get-AzureRmSubscription -SubscriptionId "b1597bc1-913e-4da7-a020-be30 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmSubscription],PSArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.GetAzureRMSubscriptionCommand