Is there any way to scale up the application gateway v1 (Increase instances) automatically using powershell commands?

Rahul Kamble 20 Reputation points
2024-10-21T07:22:37.2566667+00:00

Is there any way to scale up the application gateway v1 (Increase instances) automatically using powershell commands?

I attempted to use an Azure Automation Account with a PowerShell Runbook, but encountered errors. Additionally, the available articles and commands found online reference deprecated commands.

I need this functionality to downscale the application gateway instances during now working hours, and scale up during working hours.

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,080 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,257 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,592 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. KapilAnanth-MSFT 46,956 Reputation points Microsoft Employee
    2024-10-21T11:59:11.0233333+00:00

    @Rahul Kamble ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I believe the lack of documentations on this is because v1 is on it's way towards retirement and customers can no longer create v1 App gateways.

    If possible, I would suggest you migrate to v2 for Production workloads.

    With that said, if you are still interested in using v1 Gateway,

    • May I ask if you used Set-AzApplicationGateway ?
      • What was the exact challenge/error message with this?
    • From Get-AzApplicationGateway and Microsoft.Network/applicationGateways, I see the property should be "capacity" under SKU.
    • Are you able to update the Number of instances using Portal?
      • Or does this fail too?
    • You can validate the exact property using "Export Template" on the Resource Blade
      • Can you share what is the value of "capacity" in Export Template JSON File?
      • Is it correctly reflecting the number of instances on the App gateway?

    Cheers,

    Kapil

    0 comments No comments

  2. Sina Salam 12,011 Reputation points
    2024-10-21T12:12:57.6266667+00:00

    Hello Rahul Kamble,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you would like to know if there is any way to scale up the application gateway v1 (Increase instances) automatically using PowerShell commands.

    Yes, you can automate scaling of Azure Application Gateway v1 (AGv1) using PowerShell, by creating a PowerShell Runbook in Azure Automation that adjusts the instance count by modifying the Sku.Capacity property of the Application Gateway. The script retrieves the Application Gateway configuration using Get-AzApplicationGateway, updates the instance count, and then applies the change with Set-AzApplicationGateway, - https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-autoscaling

    Also, you can schedule this Runbook to scale up during working hours and scale down during non-working hours. You will need to make sure that your Automation Account is configured with the correct Az PowerShell modules and that the Runbook has sufficient permissions using a Run As Account or Managed Identity - https://learn.microsoft.com/en-us/powershell/module/az.network/?view=azps-10.11.0

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.