官术网_书友最值得收藏!

PowerShell commandlets

The second way to communicate with Azure Stack is PowerShell. With the wide range of PowerShell commandlets (cmdlets), everything is possible. From the administration point of view, it is always the better choice to use PowerShell, because it is reusable and redoable, and each script is a documentation itself.

The steps to enable PowerShell are as follows:

  1. Enter the following command to check for installed PowerShell modules:
      Get-PSRepository  
  1. Install the AzureRM module:
      Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201
-Force
  1. Verify the installation status:
      Get-Command -Module AzureRM.AzureStackAdmin  
  1. Now you can start over with AzureRM PowerShell commands. Connecting to Azure Stack using PowerShell should look like this:
      $AADUserName='YourAADAccount@Yourdomain'
      $AADPassword='YourAADPassword'|ConvertTo-SecureString -Force
-AsPlainText
$AADCredential=New-Object PSCredential($AADUserName,$AADPassword) $AADTenantID = "YourAADDomain" Add-AzureRmEnvironment -Name "Azure Stack" ` -ActiveDirectoryEndpoint
("https://login.windows.net/$AADTenantID/") `
-ActiveDirectoryServiceEndpointResourceId
"https://azurestack.local-api/" `
-ResourceManagerEndpoint ("https://api.azurestack.local/") ` -GalleryEndpoint ("https://gallery.azurestack.local:30016/") ` -GraphEndpoint "https://graph.windows.net/" $env = Get-AzureRmEnvironment 'Azure Stack' Add-AzureRmAccount -Environment $env -Credential $AADCredential
- Verbose
Get-AzureRmSubscription -SubscriptionName "youroffer" |
Select-AzureRmSubscription
Get-AzureRmResource

Simple, isn't it?

主站蜘蛛池模板: 始兴县| 忻州市| 武强县| 成安县| 大庆市| 个旧市| 绥德县| 普安县| 贺兰县| 石棉县| 沁阳市| 即墨市| 石林| 邮箱| 玉溪市| 连平县| 化州市| 敦化市| 连云港市| 皮山县| 万山特区| 无为县| 汉中市| 昌吉市| 利津县| 吉安县| 德保县| 临武县| 饶平县| 永嘉县| 康平县| 都昌县| 彭泽县| 铁力市| 托里县| 墨脱县| 青铜峡市| 邛崃市| 海阳市| 雅安市| 高密市|