One, Azure PowerShell deployment 1, using Powershellget to install Azure PowerShell on Windows starting with Azure PowerShell version 6.0, Azure PowerShell requires Pow Ershell version 5.0. To view the version of PowerShell that is running on the computer, run the following command: # $PSVersionTable. PSVersion2, Windows PowerShell upgrade https://docs.microsoft.com/ zh-cn/powershell/scripting/setup/installing-windows-powershell?view=powershell-6# Upgrading-existing-windows-powershell
Download the corresponding PowerShell upgrade patch 3 and start using Azure PowerShell based on the Windows version
PS c:\users\administrator> install-module-name azurerm need to use NuGet provider to continue operation Powershellget need to use NuGet provider "2.8.5.201" or later versions to interact with NuGet-based repositories. Must be in "C:\ProgramFiles\PackageManagement\ProviderAssemblies" or "C:\Users\Administrator\AppData\Local\ The NuGet provider is available in packagemanagement\providerases. You can also run the ' install-packageprovider-name nuget-minimumversion 2.8.5.201-force ' NuGet provider. Do you want Powershellget to install and import the NuGet provider now? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y untrusted repository you are installing a module from an untrusted repository. If you trust the repository, change its installationpolic value by running the Set-psrepository cmdlet. Are you sure you want to install the module from "Psgallery"? [Y] yes [A] yes to all [N] no [L] no-all [S] Suspend [?] Help (Default is "N"): APS c:\users\administrator>ps c:\users\administrator> Login-azurermaccount- Environmentname azurechinacloud//Login China Azureaccount: * * * @XXX. Partner.onmschina.cnSubscriptionName:Windows A Zure Enterprise C571e67fsubscriptionid: ***********************************tenantid: ********************************* **enviroNment:azurechinacloud
Second, virtual machine installation 1, create resource group ps c:\users\administrator> new-azurermresourcegroup-name lgp2-location ChinaEast ResourceGroupName:lgp2Location : chinaeastprovisioningstate:succeededtags :resourceid :/subscriptions/ C571E67F-785F-4DD6-8CD6-24DE40A3812B/RESOURCEGROUPS/LGP2 2, create VMS using NEW-AZURERMVM. Provide the name of each resource, and if those resources do not exist, the NEW-AZURERMVM cmdlet will create them. When prompted, provide the user name and password to use as the VM login credentials: PS c:\users\administrator> new-azurermvm ' >> -resourcegroupname "LGP2" ' >> -name ' MyVM ' >> -location ' China East ' >> -virtualnetworkname "MyVnet" ' >> -SUbnetname "Mysubnet" >> -securitygroupname "Mynetworksecuritygroup" ' >> -publicipaddressname "mypublicipaddress" >> -openports 80,3389 >>//Virtual Machine Creation Successful System Information 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, Remote to virtual machine //virtual machine public IP address information ipaddreSS /  &NBS p;---------139.219.134.125 //remote to Virtual machine PS c:\users\administrator> mstsc/v:139.219.134.125 // Virtual machine Deployment IIS services ps c:\users\cyberadmin> in Stall-windowsfeature-name web-server-includemanagementtools success Restart Needed Exit Code Feature Result------------------------------ ------- -------true no Success {Common HTTP Features, Default Document, D ... 4. Delete all related virtual resources PS c:\users\administrator> Remove-azurermresourcegroup-name lgp2 confIrmare sure you want to remove resource group ' LGP2 ' [Y] Yes [n] No [s] Suspend [? Help (Default is "Y"): ytrue
Installing Azure PowerShell and Azure PowerShell deployment virtual machines on Windows