When managing our Azure web portals, we usually rely on the Azure Portal, which allows us to handle everything visually and intuitively. However, we should not forget that Azure resources can also be managed through Windows PowerShell, enabling a more technical, precise, and scalable approach—allowing changes across multiple websites with a single line of code.
To begin our journey with Azure PowerShell, we’ll briefly explain what PowerShell is. PowerShell is a much more advanced and powerful command-line interface than traditional tools like MS-DOS or CMD. It allows full administration of Windows-based systems.
What truly sets PowerShell apart is that it is an object-oriented command interpreter. Input and output data at each stage of the process are handled as collections of objects, unlike traditional command-line tools that only work with plain text.
What is Azure PowerShell?
Azure PowerShell is a module that provides cmdlets (commands) for managing Azure subscriptions directly from PowerShell. With it, you can configure, create, and manage all Azure services and solutions. Anything you can do through the Azure Portal can also be accomplished using Azure PowerShell cmdlets.
Installing Azure PowerShell
The fastest and easiest way to start using Azure PowerShell is by downloading the installer from the following link: “Azure PowerShell http://aka.ms/webpi-azps”.
This installer will display a list of available applications. You should install Microsoft Azure PowerShell, which adds the necessary cmdlets to connect to Azure from a PowerShell console.

Getting started with PowerShell
First, open PowerShell. Before connecting to Azure, verify that the Azure PowerShell module is correctly installed on your machine.
# Display the list of installed modules
Get-Module –ListAvailable
# If Azure PowerShell is not listed, import the module
Import-Module Azure
Next, connect using your Azure credentials:
# Sign in to Azure
Add-AzureAccount
Managing Azure Websites with PowerShell
To manage the correct Azure subscription, list all available subscriptions associated with your credentials and select the one hosting your websites.
# List available subscriptions
Get-AzureSubscription
# Select a subscription
Select-AzureSubscription "Subscription Name"
# List all Azure Websites in the selected subscription
Get-AzureWebsite

To retrieve detailed information about a specific website:
Get-AzureWebsite –Name "Website Name"
This information can be stored in a variable, allowing you to explore and modify its properties easily.
# Store website data in a variable
$variable = Get-AzureWebsite –Name "Website Name"
# Apply configuration changes
Set-AzureWebsite –Name "Website Name" –SiteWithConfig $variable
The easiest way to modify multiple website properties is by editing the stored object and passing it back to the Set-AzureWebsite command. Additional administrative tasks can be performed using the various parameters available in this cmdlet.
You can also use pipelines to execute actions across all websites in a subscription.
# Stop all websites in the subscription
Get-AzureWebsite | Stop-AzureWebsite

Creating an Azure Website with PowerShell
Creating a new Azure Website is quick and simple:
# List available locations
Get-AzureWebsiteLocation
# Check if a website name is available (False means available)
Test-AzureName –Website "WebsiteName"
# Create a new Azure Website
New-AzureWebsite –Location "LocationName" –Name "WebsiteName"
Deleting an Azure Website
Removing an Azure Website via PowerShell is just as easy:
Remove-AzureWebsite –Name "WebsiteName"
To delete all Azure Websites in a subscription:
Get-AzureWebsite | Remove-AzureWebsite
Azure PowerShell is one of the most powerful tools Microsoft provides for managing and administering its cloud environment. It enables advanced automation, precise control, and scalable management of Azure services.
In future posts, we’ll explore additional commands and scripts that help optimize and streamline services within Microsoft Azure using PowerShell.