There are a lot of ways to manage it, including the recently updated preview Management portal in Azure China and the Azure Cloud Assistant, all of which are great ways to manage azure, and today we'll talk about a more efficient way to manage azure PowerShell. Friends familiar with the command line know thatLinux is so useful because of its powerful command-line tools, can simply and directly manage our servers, applications and so on. Yet Microsoft also launched its own command-line channel early on, and that's exactly what we called PowerShell.
Why do you say Is PowerShell so powerful? Because of productsfrom Windows 8, service-side systems that follow, such as Exchange,Lync,SharePoint,SQL , AD and so on), we can see PowerShell everywhere, Yes,PowerShell is omnipotent, can operate UI implementation of PowerShell can do, can't operate UI -Implemented PowerShell can do the same! It's that powerful, but today we're going to share how to use Azure PowerShell to efficiently manage our public cloud services.
First we need to install the latest PowerShell command-line tool module, the latest version of Azure PowerShell:
Https://github.com/Azure/azure-powershell/releases
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/88/21/wKioL1fqVyKTketRAAE9jHS_xH0189.png "/>
or by installing Web Platform Installer 5.0, by The UI interface downloads The latest version of Azure PowerShell.
Https://www.microsoft.com/web/downloads/platform.aspx
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/88/21/wKioL1fqVyOi0KLZAABcKlhzubo199.png "/>
In fact, it is also very convenient, in addition to downloading Azure PowerShell, we can also use the Web Platform 5.0 to do more things, and here is no longer extended, too far.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/88/25/wKiom1fqVyWBxp3PAADdM1l0mJw608.png "/>
Find Us Azure PowerShell, select Add, and then click Install below to receive the Setup project confirmation, we confirm without error Click I agree to start the installation.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/88/25/wKiom1fqVyeT8z4LAAFCDXx7CFQ531.png "/>
when we're done, we can start Enter PowerShelland open our PowerShell (Remember to right-click the administrator to run).
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/88/21/wKioL1fqVyjhm0hXAACuT7iew88677.png "/>
When you open it, you'll find it with us. There is no difference between PowerShell, because we are only installing the PowerShell Extension Module for Azure.
Next, we need to sign in to our cloud account and need to use your subscription to manage your service. If you don't have an Azure subscription, you can buy one. Enter the following command to log in:
Login-azurermaccount-environmentname Azurechinacloud
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/88/25/wKiom1fqVyrTAaoJAADKsTbM2do483.png "/>
Azure authenticates and saves credential information, and then closes the window. You can also log in directly through the PowerShell cmdlet and enter the following command:
$cred =get-credential
Login-azurermaccount-environmentnameazurechinacloud-credential$cred
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/88/21/wKioL1fqVyyR_Pa2AADuoBVCs9U987.png "/>
If the login is successful, the account information will be displayed, the tenant ID subscription ID , and subscription name. It is important to note that:
1. There are two ways of logging in, Classic mode (Azureaccount) and resource Group mode (Azurermaccount). In particular, Classic mode and resource group mode have the following differences:
Azure : Includes traditional cmdlets for managing individual resources, such as storage accounts, sites, databases, virtual machines, and media services .
Azureresourcemanager that contains a complex service for the An Azure resource is a cmdlet that is created, managed, and deployed as a logical unit . Use this module to create resource groups that support Web portals, photo galleries, blogs,wikis, and more.
2, this is a one-time login, as we access through the browser Like the Azure management portal, sessions have a certain period of validity.
if we want to start up for a long time, PowerShell can run Azure PowerShell management cmdlets, we can do this in one of the following ways. To execute the Azure PowerShell command:
Get-azurepublishsettingsfile-environment Azurechinacloud
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/88/25/wKiom1fqVy6glZJIAAFSRHZeb1o686.png "/>
Then enter your username and password in the browser page and log in to the Azure subscription account that we want to manage:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/88/21/wKioL1fqVy_jRulpAADp4U6kyvM760.png "/>
The subscription settings file is then generated, and we need to save it for the next import operation.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/88/25/wKiom1fqVzGzXWkgAAEEgx2rEp8049.png "/>
Make sure we do. the location and name of the Azure subscription file (preferably not in Chinese).
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/88/21/wKioL1fqVzPDypPJAAD9-nugLr4436.png "/>
It is important to note that the way you import does not lose administrative rights because we are shutting down PowerShell or restarting the computer, so be sure to use the Import method for Azure in a secure and reliable computer PowerShell Management.
and then we can go through PowerShell Imports It, enter the following command to import the subscription file:
Import-azurepublishsettingsfile X: \xxxxxxxx.publishsettings
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/88/21/wKioL1fqVzXAYxVuAAGklnJ0klM604.png "/>
the current subscription will be displayed if the import is complete without problems ID, subscription name, and other related information.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/88/25/wKiom1fqVzbwhy_IAAClkEkL88g874.png "/>
this time we can use Azure PowerShell cmdlet , such as get-azurevm<span style= "font-family
This article is from the "Reinember" blog, make sure to keep this source http://reinember.blog.51cto.com/2919431/1857099
Azure OPS Series 3: Installing and using Azure PowerShell management cloud