如何按名称测试 Azure 服务是否存在?
How can I test whether an Azure Service exists or not, by name?
例如,我将在 PowerShell ISE 中使用它(具有管理员权限),per the documentation:
Test-AzureName –Service "MyNameService1"
预期结果:
此命令测试 "MyNameService1" 是否为现有的 Microsoft Azure 云服务名称。
实际结果:
Test-AzureName : Could not load file or assembly 'Microsoft.ServiceBus, Version=2.3.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At line:1 char:1
+ Test-AzureName –Service "MyNameService1"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Test-AzureName], FileNotFoundException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.CloudService.TestAzureNameCommand
我只是不明白这是在告诉我什么,尤其是因为我从文档中复制并粘贴了代码。我应该在这里本地安装一些东西吗?
您可以使用以下 PowerShell 检查您的云环境中是否存在服务。
Get-AzureRmResourceProvider
注意:您需要有 Azure PowerShell 1.0.0 或更高版本。
在使用此命令之前,您需要登录到您的 Azure 云。
Login-AzureRmAccount
你会得到类似这样的输出:
ProviderNamespace RegistrationState ResourceTypes Locations
----------------- ----------------- ------------- ---------
Microsoft.AppService Registered {apiapps, appIdentities, gateways, deploymenttemplates...} {East US, West US, South Central US, North Europe...}
Microsoft.Backup Registered {BackupVault} {West US, East US, North Europe, West Europe...}
Microsoft.Batch Registered {batchAccounts, operations, locations, locations/quotas} {West Europe, East US, East US 2, West US...}
Microsoft.ClassicCompute Registered {domainNames, checkDomainNameAvailability, domainNames/slots, domainNames/slots/roles...} {East Asia, Southeast Asia, East US, East US 2...}
Microsoft.ClassicNetwork Registered {virtualNetworks, reservedIps, quotas, gatewaySupportedDevices...} {East Asia, Southeast Asia, East US, East US 2...}
Microsoft.ClassicStorage Registered {storageAccounts, quotas, checkStorageAccountAvailability, storageAccounts/services...} {East Asia, Southeast Asia, East US, East US 2...}
Microsoft.Compute Registered {availabilitySets, virtualMachines, virtualMachines/extensions, virtualMachines/diagnosticSettings...} {East US, East US 2, West US, Central US...}
microsoft.insights Registered {components, webtests, queries, alertrules...} {Central US, West US, East US, North Europe...}
Microsoft.MobileEngagement Registered {appcollections, appcollections/apps, checkappcollectionnameavailability, supportedplatforms} {Central US, North Europe}
Microsoft.Network Registered {virtualNetworks, publicIPAddresses, networkInterfaces, loadBalancers...} {West US, East US, North Europe, West Europe...}
Microsoft.OperationalInsights Registered {workspaces, storageInsightConfigs, linkTargets, operations} {East US, West Europe}
Microsoft.Scheduler Registered {jobcollections, operations} {North Central US, South Central US, North Europe, West Europe...}
Microsoft.Sql Registered {operations, locations, locations/capabilities, checkNameAvailability...} {West Europe, South Central US, East US 2, Central US...}
Microsoft.Storage Registered {storageAccounts, operations, usages, checkNameAvailability...} {East US, East US 2, East US 2 (Stage), West US...}
Microsoft.Web Registered {sites/extensions, sites/slots/extensions, sites/instances, sites/slots/instances...} {Brazil South, East Asia, East US, Japan East...}
Microsoft.ADHybridHealthService Registered {services, addsservices, configuration, operations...} {West US}
Microsoft.Authorization Registered {roleAssignments, roleDefinitions, classicAdministrators, permissions...} {}
Microsoft.Features Registered {features, providers} {}
Microsoft.Resources Registered {subscriptions, subscriptions/providers, subscriptions/operationresults, resourceGroups...} {Central US, East Asia, Southeast Asia, East US...}
microsoft.support Registered {operations, supporttickets} {North Central US, South Central US, Central US, West Europe...}
microsoft.visualstudio Registered {account, account/project} {North Central US, South Central US, East US, West US...}
每个ProviderNamespace对应一个大服务,在一个namespace中可以使用如下命令查看详情:
Get-AzureRmResourceProvider -ProviderNamespace Microsoft.AppService
注意:此命令将为您提供 AppService 提供的所有资源类型。
有些服务没有出现在这个列表中。我不确定为什么。例如:
Get-AzureRmResourceProvider -ProviderNamespace Microsoft.HDInsight
Microsoft.HDInsight 不在列表中。
获得更多
例如,我将在 PowerShell ISE 中使用它(具有管理员权限),per the documentation:
Test-AzureName –Service "MyNameService1"
预期结果:
此命令测试 "MyNameService1" 是否为现有的 Microsoft Azure 云服务名称。
实际结果:
Test-AzureName : Could not load file or assembly 'Microsoft.ServiceBus, Version=2.3.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At line:1 char:1
+ Test-AzureName –Service "MyNameService1"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Test-AzureName], FileNotFoundException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.CloudService.TestAzureNameCommand
我只是不明白这是在告诉我什么,尤其是因为我从文档中复制并粘贴了代码。我应该在这里本地安装一些东西吗?
您可以使用以下 PowerShell 检查您的云环境中是否存在服务。
Get-AzureRmResourceProvider
注意:您需要有 Azure PowerShell 1.0.0 或更高版本。
在使用此命令之前,您需要登录到您的 Azure 云。
Login-AzureRmAccount
你会得到类似这样的输出:
ProviderNamespace RegistrationState ResourceTypes Locations
----------------- ----------------- ------------- ---------
Microsoft.AppService Registered {apiapps, appIdentities, gateways, deploymenttemplates...} {East US, West US, South Central US, North Europe...}
Microsoft.Backup Registered {BackupVault} {West US, East US, North Europe, West Europe...}
Microsoft.Batch Registered {batchAccounts, operations, locations, locations/quotas} {West Europe, East US, East US 2, West US...}
Microsoft.ClassicCompute Registered {domainNames, checkDomainNameAvailability, domainNames/slots, domainNames/slots/roles...} {East Asia, Southeast Asia, East US, East US 2...}
Microsoft.ClassicNetwork Registered {virtualNetworks, reservedIps, quotas, gatewaySupportedDevices...} {East Asia, Southeast Asia, East US, East US 2...}
Microsoft.ClassicStorage Registered {storageAccounts, quotas, checkStorageAccountAvailability, storageAccounts/services...} {East Asia, Southeast Asia, East US, East US 2...}
Microsoft.Compute Registered {availabilitySets, virtualMachines, virtualMachines/extensions, virtualMachines/diagnosticSettings...} {East US, East US 2, West US, Central US...}
microsoft.insights Registered {components, webtests, queries, alertrules...} {Central US, West US, East US, North Europe...}
Microsoft.MobileEngagement Registered {appcollections, appcollections/apps, checkappcollectionnameavailability, supportedplatforms} {Central US, North Europe}
Microsoft.Network Registered {virtualNetworks, publicIPAddresses, networkInterfaces, loadBalancers...} {West US, East US, North Europe, West Europe...}
Microsoft.OperationalInsights Registered {workspaces, storageInsightConfigs, linkTargets, operations} {East US, West Europe}
Microsoft.Scheduler Registered {jobcollections, operations} {North Central US, South Central US, North Europe, West Europe...}
Microsoft.Sql Registered {operations, locations, locations/capabilities, checkNameAvailability...} {West Europe, South Central US, East US 2, Central US...}
Microsoft.Storage Registered {storageAccounts, operations, usages, checkNameAvailability...} {East US, East US 2, East US 2 (Stage), West US...}
Microsoft.Web Registered {sites/extensions, sites/slots/extensions, sites/instances, sites/slots/instances...} {Brazil South, East Asia, East US, Japan East...}
Microsoft.ADHybridHealthService Registered {services, addsservices, configuration, operations...} {West US}
Microsoft.Authorization Registered {roleAssignments, roleDefinitions, classicAdministrators, permissions...} {}
Microsoft.Features Registered {features, providers} {}
Microsoft.Resources Registered {subscriptions, subscriptions/providers, subscriptions/operationresults, resourceGroups...} {Central US, East Asia, Southeast Asia, East US...}
microsoft.support Registered {operations, supporttickets} {North Central US, South Central US, Central US, West Europe...}
microsoft.visualstudio Registered {account, account/project} {North Central US, South Central US, East US, West US...}
每个ProviderNamespace对应一个大服务,在一个namespace中可以使用如下命令查看详情:
Get-AzureRmResourceProvider -ProviderNamespace Microsoft.AppService
注意:此命令将为您提供 AppService 提供的所有资源类型。
有些服务没有出现在这个列表中。我不确定为什么。例如:
Get-AzureRmResourceProvider -ProviderNamespace Microsoft.HDInsight
Microsoft.HDInsight 不在列表中。
获得更多