What is Azure PowerShell?
Azure PowerShell is a set of cmdlets (command-lets) for managing Azure resources from the PowerShell command line. It provides a comprehensive and powerful toolset for managing Azure resources, including virtual machines, storage accounts, databases, and networking components. Azure PowerShell is widely used by IT professionals to automate tasks, manage complex deployments, and troubleshoot Azure issues.
What is cmdlets?
Cmdlets, pronounced “command-lets”, are the smallest unit of functionality in PowerShell. They are lightweight commands that are used in the PowerShell environment. Each cmdlet is a .NET Framework class that packages a specific set of functionality. Cmdlets follow a verb-noun naming pattern, such as Get-Help, Get-Process, and Start-Service, which makes them self-descriptive and easy to understand. They are designed to do one thing and do it well, with a consistent interface that makes it easy to chain together in scripts for more complex tasks. Cmdlets can be used to perform operations like managing system processes, reading and writing files, and manipulating data structures.
Install Azure PowerShell on Windows
1. Run the following command from PowerShell to determine your PowerShell version:
$PSVersionTable.PSVersion
2. Determine if you have the AzureRM PowerShell module installed
Get-Module -Name AzureRM -ListAvailable
3. Update to Windows PowerShell 5.1
4. Install .NET Framework 4.7.2 or later
5. Set the PowerShell script execution to remote signed or less restrictive. Check the PowerShell execution policy:
Get-ExecutionPolicy -List
6. Set the PowerShell execution policy to remote signed:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
7. Copy and Paste the following command to install this package using PowerShellGet
Install-Module -Name Az
or
Install-Module -Name Az -Repository PSGallery -Force
8. To update
Update-Module -Name Az
Install Azure PowerShell on Linux
Open the Terminal or other shell host application and run pwsh to start PowerShell.
Use the Install-Module cmdlet to install the Az PowerShell module:
Install-Module -Name Az -Repository PSGallery -Force
PowerShell Commands List
Here are 25 basic PowerShell commands:
Command name | Alias | Description |
---|---|---|
Set-Location | cd, chdir, sl | Sets the current working location to a specified location. |
Get-Content | cat, gc, type | Gets the content of the item at the specified location. |
Add-Content | ac | Adds content to the specified items, such as adding words to a file. |
Set-Content | sc | Writes or replaces the content in an item with new content. |
Copy-Item | copy, cp, cpi | Copies an item from one location to another. |
Remove-Item | del, erase, rd, ri, rm, rmdir | Deletes the specified items. |
Move-Item | mi, move, mv | Moves an item from one location to another. |
Set-Item | si | Changes the value of an item to the value specified in the command. |
New-Item | ni | Creates a new item. |
Start-Job | sajb | Starts a Windows PowerShell background job. |
Compare-Object | compare, dif | Compares two sets of objects. |
Group-Object | group | Groups objects that contain the same value for specified properties. |
Invoke-WebRequest | curl, iwr, wget | Gets content from a web page on the Internet. |
Measure-Object | measure | Calculates the numeric properties of objects, and the characters, words, and lines in string objects, such as files … |
Resolve-Path | rvpa | Resolves the wildcard characters in a path, and displays the path contents. |
Resume-Job | rujb | Restarts a suspended job |
Set-Variable | set, sv | Sets the value of a variable. Creates the variable if one with the requested name does not exist. |
Show-Command | shcm | Creates Windows PowerShell commands in a graphical command window. |
Sort-Object | sort | Sorts objects by property values. |
Start-Service | sasv | Starts one or more stopped services. |
Start-Process | saps, start | Starts one or more processes on the local computer. |
Suspend-Job | sujb | Temporarily stops workflow jobs. |
Wait-Job | wjb | Suppresses the command prompt until one or all of the Windows PowerShell background jobs running in the session are … |
Where-Object | ?, where | Selects objects from a collection based on their property values. |
Write-Output | echo, write | Sends the specified objects to the next command in the pipeline. If the command is the last command in the pipeline,… |
Azure Powershell Commands and Cheat Sheet
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024