Open In App

Microsoft Azure – Azure App Servers Routing using PowerShell

Last Updated : 30 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will look into how to add logic to your testing and production sites with PowerShell.  I Azure, you could split the traffic that goes between your staging slot on your production slot by defining routing rules inside the Azure portal. Now, what if you wanted to do this programmatically via maybe a PowerShell script. 

One of the things that we could do is head over to the Azure CLI website, and we can install the PowerShell modules that allow us to programmatically manage our resources inside the cloud. 

Now we already have this installed. We are going to open a local PowerShell instance. Here in this machine and using the script we are going to set our staging slot to receive 90% of the traffic instead of 50%. 

Now that’s complete we’ll go back over to the Azure Portal. Here we’ll need to just refresh the page real quick. When we head back over to the testing and production section you should see now our values have changed to 90% to staging and 10% to production. 

Now, what if we want to have more fine-grained control over how these changes happen. We’ll head over to a second PowerShell tab and we have a second script there. What it does is that every 60 minutes it’ll increase the amount of traffic that goes over to our staging slot by 5%. Let’s go ahead and run this. 

That script is complete and just like before we are going to refresh the page quickly. Now that we’ve run that script every 60 seconds we’ll slowly see more and more traffic heading over to our staging slot. 

And that’s how you can control the azure app servers routing rules for your staging slots using PowerShell.


Previous Article
Next Article

Similar Reads

Microsoft Azure - Get Azure VM Properties using Azure PowerShell
The purpose of using the Azure PowerShell Commands is to quickly analyze the overall properties of VM/VMs at once the filtering the with select and where conditions. To find the properties of an Azure VM, you can perform the following commands in Azure Cloud Shell to get the details. Command: Get-AzVM Output: 1. Get all properties of an Azure Virtu
2 min read
Microsoft Azure - Check Status of Azure VM using Azure PowerShell
The following Azure PowerShell command helps you to find the Azure VM Config and properties details of Os Name, Os Version, Hyper V Generation, Disks properties, Extensions properties of Type Handler Version, Status and Message, VM Agents properties of Type Handler Version, Status and Message and also VM Power Status Codes, Messages, Plugins, Time
3 min read
Microsoft Azure - Manage Azure VMs using Azure PowerShell Commands
Here we are using Azure PS Commands to manage azure resources from Azure Cloud Shell or by using Windows PowerShell. By using the simple AZ PS command we can manage Azure VM Quicks without any efforts of navigating in Azure Portal and at Scale. Let's get started by using the major Azure PS commands to manage Azure Virtual Machine. 1. Start a Specif
2 min read
Microsoft Azure - Azure Managed Disk State Details using PowerShell
In this article, we will try to understand how we can fetch the VM Disk State by using the Azure PowerShell Commands. With the help of the Azure PowerShell Commands, we will be finding the Managed Disk State of Unattached, Attached, and Reserved of all the Azure VM Disks within Subscription. Implementation: Follow the below steps to get azure manag
1 min read
Microsoft Azure - Resize a Azure Virtual Machine for Windows or Linux Servers
In this article, we will look into the process of resizing Azure VM size for Linux and Windows servers. Implementation: Follow the below steps to resize a Azure Virtual Machine with new size. Note: The Process is same for both the Windows and Linux OS Servers. Step 1: Log in to Azure Portal. Step 2: Go to Virtual Machines and select your Virtual Ma
2 min read
Microsoft Azure - Fetch License Details of Azure Servers
In this article, we'll fetch the details of all Azure Virtual Machine License Details within the Subscription using the Azure PowerShell Module Script. What we can achieve with the script? We will fetch of details of Azure VM which has License and also we also fetch the details like where Azure VM without any License or License not activated. The S
2 min read
Differences between Cloud Servers and Dedicated Servers
Cloud Servers A cloud server is essentially an Infrastructure as a Service-based cloud service model that is facilitated and typically virtual, compute server that is accessed by users over a network. Cloud servers are expected to give the same functions, bolster the equivalent operating systems (OSes) and applications, and offer the performance qu
4 min read
How to Configure Azure Activity "Administrative" Logs on Azure Subscription using PowerShell?
Azure Activity "Administrative" logs are a type of activity log that record events that occur in your Azure subscription. By enabling and configuring the Azure Activity "Administrative" logs will collect and store logs in your specified log analytics workspace (this is your log destination). Administrative logs help you to view and analyze the logs
3 min read
Microsoft Azure - Resizing Virtual Machine Using PowerShell Script
In this article, we will look into the process of resizing azure VMs at once using the Azure PowerShell automation script in the Azure portal by using the cloud shell. Advantages of using the method approach: Resizing Multiple VMs at once in a follow for select subscriptionSaves the time of the UserSimplifying the Actions by Automating the processR
2 min read
Microsoft Azure - Deletion of Snapshots using PowerShell Script
Snapshot is a kind of read-only copy of the existing Azure VM disk of either OS disk or data disk. This snapshot is used as a backup for VM in case of any failure to retrieve the backup of a VM in case of crashes. In this article, you will learn about the deletion of all the Snapshots within the Subscription from all the Resource Groups at once usi
2 min read