Connect PowerShell with Microsoft Azure

ad+1


You can use Windows PowerShell to perform a variety of tasks in Azure, either interactively at a command prompt or automatically through scripts. Azure PowerShell is a module that provides cmdlets to manage Azure through Windows PowerShell. You can use the cmdlets to create, test, deploy, and manage solutions and services delivered through the Azure platform. In most cases, you can use the cmdlets to perform the same tasks that you can perform through the Azure Management Portal. For example, you can create and configure cloud services, virtual machines, virtual networks, and web apps.

Step 1:  Download and Install Microsoft Azure PowerShell Module for Microsoft Azure

Download and install the Azure PowerShell modules by running the Microsoft Web Platform Installer
When prompted, click Run. The Web Platform Installer installs the Azure PowerShell modules and all dependencies. Follow the prompts to complete the installation.
Installing the module also installs a customized console for Azure PowerShell. You can run the cmdlets from either the standard Windows PowerShell console or the Azure PowerShell console.

Step 2: Run the Microsoft Azure PowerShell

The method you use to open either console depends on the version of Windows you're running:
  • On a computer running at least Windows 8 or Windows Server 2012, you can use the built-in Search. From the Start screen, begin typing power. This returns a scoped list of apps that includes Windows PowerShell and Azure PowerShell. To open the console, click either app. (To pin the app to the Start screen, right-click the icon.)
  • On a computer running a version earlier than Windows 8 or Windows Server 2012, use the Start menu. From the Start menu, click All Programs, click Azure, and then click Azure PowerShell

Step 3:  Run Add-AzureAccount cmdlet.

Step 4: Login with your Admin Credential.

Don’t worry if you have ADFS implemented. You will automatically redirect to ADFS Page (as you do when logging into Office 365).

Step 5:  Select Current Subscription.

After putting credential, you should be able to see prompt like below and ready to use Windows Azure by PowerShell.
Before you do anything, ensure you are in the right subscription. First thing you want to do is check which subscription is currently live and change if required.
Check current Subscription: Get-AzureSubscription | select SubscriptionName, IsCurrent
If your subscription is already showing True in the IsCurrent Column, no further actions required, else run the following command and check the results using same command (Get-AzureSubscription | select SubscriptionName, IsCurrent)
Select-Azuresubscription
Now, you can run any valid PowerShell command against your Azure subscription. For any help, there is a great command called Get-Help.

0 comments:

I welcome you to write your comments here..