標籤:sga rest cee 程式 虛擬 storage class 需要 min
一、Azure PowerShell部署 1、使用 PowerShellGet 在 Windows 上安裝 Azure PowerShell從 Azure PowerShell 版本 6.0 開始,Azure PowerShell 需要 PowerShell 版本 5.0。 若要查看在電腦上啟動並執行 PowerShell 的版本,運行以下命令:#$PSVersionTable.PSVersion2、Windows PowerShell升級https://docs.microsoft.com/zh-cn/powershell/scripting/setup/installing-windows-powershell?view=powershell-6#upgrading-existing-windows-powershell
//根據windows版本下載對應的powershell升級補丁 3、開始使用Azure powershell
PS C:\Users\Administrator> Install-Module -Name AzureRM需要使用 NuGet 提供者來繼續操作PowerShellGet 需要使用 NuGet 提供者“2.8.5.201”或更高版本來與基於 NuGet 的存放庫互動。必須在“C:\ProgramFiles\PackageManagement\ProviderAssemblies”或“C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAses”中提供 NuGet 提供者。也可以通過運行 ‘Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force‘NuGet 提供者。是否要讓 PowerShellGet 立即安裝並匯入 NuGet 提供者?[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y不受信任的存放庫你正在從不受信任的存放庫安裝模組。如果你信任該存放庫,請通過運行 Set-PSRepository cmdlet 更改其 InstallationPolic值。是否確實要從“PSGallery”安裝模組?[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): APS C:\Users\Administrator>PS C:\Users\Administrator> Login-AzureRmAccount -EnvironmentName AzureChinaCloud //登入中國AzureAccount : ***@XXX.partner.onmschina.cnSubscriptionName : Windows Azure 企業 c571e67fSubscriptionId : ***********************************TenantId : ***********************************Environment : AzureChinaCloud
二、虛擬機器安裝 1、建立資源群組 PS C:\Users\Administrator> New-AzureRmResourceGroup -Name lgp2 -Location ChinaEast ResourceGroupName : lgp2Location : chinaeastProvisioningState : SucceededTags :ResourceId : /subscriptions/c571e67f-785f-4dd6-8cd6-24de40a3812b/resourceGroups/lgp2 2、建立虛擬機器使用 New-AzureRmVM 建立 VM。 請提供每個資源的名稱,如果這些資源不存在,New-AzureRmVM cmdlet 會建立它們。//出現提示時,提供用作 VM 登入憑據的使用者名稱和密碼:PS C:\Users\Administrator> New-AzureRmVm ` >> -ResourceGroupName "lgp2" `>> -Name "myVM" `>> -Location "China East" `>> -VirtualNetworkName "mySLB/VPC Operations and Maintenance System" `>> -SubnetName "mySubnet" `>> -SecurityGroupName "myNetworkSecurityGroup" `>> -PublicIpAddressName "myPublicIpAddress" `>> -OpenPorts 80,3389>>//虛擬機器建立成功的系統資訊ResourceGroupName : lgp2Id : /subscriptions/c571e67f-785f-4dd6-8cd6-24de40a3812b/resourceGroups/lgp2/providers/Microsoft.Compute/virtualMachines/myVMVmId : c4dd1ef3-cf2d-47f3-939b-fec3f9f27f73Name : myVMType : Microsoft.Compute/virtualMachinesLocation : chinaeastTags : {}HardwareProfile : {VmSize}NetworkProfile : {NetworkInterfaces}OSProfile : {ComputerName, AdminUsername, WindowsConfiguration, Secrets}ProvisioningState : SucceededStorageProfile : {ImageReference, OsDisk, DataDisks}FullyQualifiedDomainName : myvm-6e4097.China East.cloudapp.azure.com PS C:\Users\Administrator> Get-AzureRmPublicIpAddress -ResourceGroupName "lgp2"|select "ipaddress"3、遠程到虛擬機器 //虛擬機器公網IP地址資訊IpAddress ---------139.219.134.125 //遠程到虛擬機器PS C:\Users\Administrator> mstsc /v:139.219.134.125 //虛擬機器部署IIS服務 PS C:\Users\cyberadmin> Install-WindowsFeature -name Web-Server -IncludeManagementTools Success Restart Needed Exit Code Feature Result------- -------------- --------- --------------True No Success {Common HTTP Features, Default Document, D...4、刪除所有相關虛擬資源PS C:\Users\Administrator> Remove-AzureRmResourceGroup -Name lgp2 ConfirmAre you sure you want to remove resource group ‘lgp2‘[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): YTrue
Windows 上安裝 Azure PowerShell及Azure PowerShell部署虛擬機器