{"id":41335,"date":"2023-11-16T05:18:45","date_gmt":"2023-11-16T05:18:45","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=41335"},"modified":"2023-11-16T05:18:47","modified_gmt":"2023-11-16T05:18:47","slug":"azure-powershell-tutorials-installations-and-user-guide","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/azure-powershell-tutorials-installations-and-user-guide\/","title":{"rendered":"Azure PowerShell Tutorials: Installations and User Guide"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is Azure PowerShell?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is cmdlets?<\/h2>\n\n\n\n<p>Cmdlets, pronounced &#8220;command-lets&#8221;, 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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install Azure PowerShell on Windows<\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-number\">1.<\/span> Run the following command <span class=\"hljs-keyword\">from<\/span> PowerShell to determine your PowerShell version:\r\n$PSVersionTable.PSVersion\r\n\r\n<span class=\"hljs-number\">2.<\/span> Determine <span class=\"hljs-keyword\">if<\/span> you have the AzureRM PowerShell <span class=\"hljs-built_in\">module<\/span> installed\r\nGet-Module -Name AzureRM -ListAvailable\r\n\r\n<span class=\"hljs-number\">3.<\/span> Update to Windows PowerShell <span class=\"hljs-number\">5.1<\/span>\r\n\r\n<span class=\"hljs-number\">4.<\/span> Install .NET Framework <span class=\"hljs-number\">4.7<\/span><span class=\"hljs-number\">.2<\/span> or later\r\n\r\n<span class=\"hljs-number\">5.<\/span> <span class=\"hljs-built_in\">Set<\/span> the PowerShell script execution to remote signed or less restrictive. Check the PowerShell execution policy:\r\nGet-ExecutionPolicy -List\r\n\r\n<span class=\"hljs-number\">6.<\/span> <span class=\"hljs-built_in\">Set<\/span> the PowerShell execution policy to remote signed:\r\n<span class=\"hljs-built_in\">Set<\/span>-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser\r\n\r\n<span class=\"hljs-number\">7.<\/span> Copy and Paste the following command to install <span class=\"hljs-keyword\">this<\/span> package using PowerShellGet\r\nInstall-Module -Name Az\r\nor\r\nInstall-Module -Name Az -Repository PSGallery -Force\r\n\r\n<span class=\"hljs-number\">8.<\/span> To update\r\nUpdate-Module -Name Az<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Install Azure PowerShell on Linux<\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Open the Terminal or other shell host application and run pwsh to start PowerShell.\r\n\r\nUse the Install-Module cmdlet to install the Az PowerShell <span class=\"hljs-built_in\">module<\/span>:\r\nInstall-Module -Name Az -Repository PSGallery -Force<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>PowerShell Commands List<\/strong><\/h2>\n\n\n\n<p>Here are 25 basic PowerShell commands:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command name<\/th><th>Alias<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>Set-Location<\/td><td>cd, chdir, sl<\/td><td>Sets the current working location to a specified location.<\/td><\/tr><tr><td>Get-Content<\/td><td>cat, gc, type<\/td><td>Gets the content of the item at the specified location.<\/td><\/tr><tr><td>Add-Content<\/td><td>ac<\/td><td>Adds content to the specified items, such as adding words to a file.<\/td><\/tr><tr><td>Set-Content<\/td><td>sc<\/td><td>Writes or replaces the content in an item with new content.<\/td><\/tr><tr><td>Copy-Item<\/td><td>copy, cp, cpi<\/td><td>Copies an item from one location to another.<\/td><\/tr><tr><td>Remove-Item<\/td><td>del, erase, rd, ri, rm, rmdir<\/td><td>Deletes the specified items.<\/td><\/tr><tr><td>Move-Item<\/td><td>mi, move, mv<\/td><td>Moves an item from one location to another.<\/td><\/tr><tr><td>Set-Item<\/td><td>si<\/td><td>Changes the value of an item to the value specified in the command.<\/td><\/tr><tr><td>New-Item<\/td><td>ni<\/td><td>Creates a new item.<\/td><\/tr><tr><td>Start-Job<\/td><td>sajb<\/td><td>Starts a Windows PowerShell background job.<\/td><\/tr><tr><td>Compare-Object<\/td><td>compare, dif<\/td><td>Compares two sets of objects.<\/td><\/tr><tr><td>Group-Object<\/td><td>group<\/td><td>Groups objects that contain the same value for specified properties.<\/td><\/tr><tr><td>Invoke-WebRequest<\/td><td>curl, iwr, wget<\/td><td>Gets content from a web page on the Internet.<\/td><\/tr><tr><td>Measure-Object<\/td><td>measure<\/td><td>Calculates the numeric properties of objects, and the characters, words, and lines in string objects, such as files \u2026<\/td><\/tr><tr><td>Resolve-Path<\/td><td>rvpa<\/td><td>Resolves the wildcard characters in a path, and displays the path contents.<\/td><\/tr><tr><td>Resume-Job<\/td><td>rujb<\/td><td>Restarts a suspended job<\/td><\/tr><tr><td>Set-Variable<\/td><td>set, sv<\/td><td>Sets the value of a variable. Creates the variable if one with the requested name does not exist.<\/td><\/tr><tr><td>Show-Command<\/td><td>shcm<\/td><td>Creates Windows PowerShell commands in a graphical command window.<\/td><\/tr><tr><td>Sort-Object<\/td><td>sort<\/td><td>Sorts objects by property values.<\/td><\/tr><tr><td>Start-Service<\/td><td>sasv<\/td><td>Starts one or more stopped services.<\/td><\/tr><tr><td>Start-Process<\/td><td>saps, start<\/td><td>Starts one or more processes on the local computer.<\/td><\/tr><tr><td>Suspend-Job<\/td><td>sujb<\/td><td>Temporarily stops workflow jobs.<\/td><\/tr><tr><td>Wait-Job<\/td><td>wjb<\/td><td>Suppresses the command prompt until one or all of the Windows PowerShell background jobs running in the session are \u2026<\/td><\/tr><tr><td>Where-Object<\/td><td>?, where<\/td><td>Selects objects from a collection based on their property values.<\/td><\/tr><tr><td>Write-Output<\/td><td>echo, write<\/td><td>Sends the specified objects to the next command in the pipeline. If the command is the last command in the pipeline,\u2026<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Azure Powershell Commands and Cheat Sheet<\/h2>\n\n\n\n<script src=\"https:\/\/gist.github.com\/devops-school\/a2362988844e201ad47c5bf894ecedaa.js\"><\/script>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-41335","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/41335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=41335"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/41335\/revisions"}],"predecessor-version":[{"id":41340,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/41335\/revisions\/41340"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=41335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=41335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=41335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}