Saturday, June 13, 2020

#97: How to Install Azure Powershell ?

PROBLEM: 

Azure portal provides a nice interactive interface to get details about configuration or drop/create resources. Sometimes, we need to connect Azure with Powershell to automate certain tasks. It can be useful if you are making your own inventory of Azure VMs, Disks allocated or performing a check whether certain resources has been created. Once resources dropped can never be recovered, to avoid human mistakes, it is always advisable to make your own repository to have a capability to recreate resources. 

Azure CLI provides different options to get the inventory details and it also provides several capabilities that Azure Powershell might not have. In this article, I will over the details about Azure Powershell AZ modules. 

How to connect to Azure Powershell from you desktop?

SOLUTION:

Assuming you have an Azure account (Free or Paid or Pay-As-You-Go).

1. Install Azure Powershell

To install, Azure Powershell make sure your machine is able to connect to Azure. If it is connected, there could still be a situation where it will not connect to Azure due to firewall blocking or server not allowing to download or perform certain tasks. 

1) You can connect to http://portal.azure.com first.     

  • If it does not connect, try to add in Internet Explorer trusted servers list that must have little low checks. 
  • Gradually add links that it denies.
  • If you are not sure what link is blocked. You can press F11 and try to see the blocked URL in console. 

2)  IE, Edge and Chrome allows connecting. But I prefer Chrome due to obvious reasons. 

3) Once connection is fine, check the modules installed on machine using below command:

get-module -ListAvailable | where { $_ -match "Az." }

-OR-
You can check very easily in Powershell ISE.



[4] If not found, you can run command like below: 

Install-Module -Name Az -AllowClobber -Scope AllUsers

2. Connect Azure 

Run the command like below: 
Connect-AzAccount
A pop-up will come. Enter your credentials. 


3. Try few commands to confirm.

Get-AzResourceGroup
Get-AzRM 
Get-AzStorageAccount 


That's all! You can find so many Powershell scripts over internet. Try them. 
From installing VM to shutting down, everything that you can do with GUI can be done with Azure Powershell. 

I will provide many script that I wrote for my purposes.\

Thanks !!!


2 comments:

  1. If you don't remember this, your car may be stolen!

    Imagine that your car was taken! When you approach the police, they inquire about a specific "VIN search"

    A VIN decoder: What is it?

    Similar to a passport, the "VIN decoder" allows you to find out the date of the car's birth and the identity of its "parent" (manufacturing facility). Additionally, you can find:

    1.Type of engine

    2.Model of a vehicle

    3.The DMV's limitations

    4.Number of drivers in this vehicle

    You will be able to locate the car, and keeping in mind the code ensures your safety. The code can be examined in the online database. The VIN is situated on various parts of the car to make it harder for thieves to steal, such as the first person's seat on the floor, the frame (often in trucks and SUVs), the spar, and other areas.

    What happens if the VIN is harmed on purpose?

    There are numerous circumstances that can result in VIN damage, but failing to have one will have unpleasant repercussions because it is illegal to intentionally harm a VIN in order to avoid going to jail or calling the police. You could receive a fine of up to 80,000 rubles or spend two years in prison. You might be held up on the road by a teacher.

    Conclusion.

    The VIN decoder may help to save your car from theft. But where can you check the car reality? This is why we exist– VIN decoders!

    ReplyDelete

#112: How to handle xml document in Powershell?

 In PowerShell, you can handle XML data using various cmdlets and methods provided by the .NET Framework. Here's a basic guide on how to...