2016-01-18 35 views
0

例如,我將在PowerShell ISE中使用(使用管理員權限),per the documentation:如何根據名稱測試Azure服務是否存在?

Test-AzureName –Service "MyNameService1" 

預期結果:

該命令測試,看看是否 「MyNameService1」 是現有的微軟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 

我只是不明白這是什麼告訴我,尤其是因爲我複製粘貼+從文檔中的代碼。我應該在本地安裝一些東西嗎?

+1

https://en.wikipedia.org/wiki/DLL_Hell – tripdubroot

回答

0

您可以使用以下PowerShell檢查您的雲環境中是否存在服務。

Get-AzureRmResourceProvider 

注意:您需要具有Azure PowerShell 1.0.0或更高版本。

在使用此命令之前,您需要登錄到Azure Cloud。

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對應於一個大的服務,你可以在命名空間中使用以下命令查看詳細:

Get-AzureRmResourceProvider -ProviderNamespace Microsoft.AppService 

注意:這個命令會給你所有AppService提供的資源類型。

某些服務未出現在此列表中。我不知道爲什麼。例如:

Get-AzureRmResourceProvider -ProviderNamespace Microsoft.HDInsight 

Microsoft.HDInsight不在列表中。

,您可以得到更多的Get-AzureRmResourceProvider

+0

這是非常翔實,謝謝! 不久之後,我意識到問題所在。我以爲我在這臺機器上安裝了Azure Powershell,但事實並非如此。奇怪的是,在它意識到它沒有安裝之前,它讓我起立了那個命令。 –

相關問題