Powershell automation script to update the container app scale

Sowndar kumaresan 21 Reputation points
2023-09-05T13:47:28.4333333+00:00

Hi team, we have created an automation script that will increase the scaling to 1 in business hours. we use the below script to do the same.

In lower env, we use a Consumption plan, and in higher env, we use a consumption + workload profile Still we are using a consumption plan only to host the container apps.

Working well in QA able to update the scaling to 1 but in the higher env we are throwing errors like "[WorkloadProfilePropertyNotSupportedInApiVersion] : WorkloadProfiles configuration is not supported in api version. Use 2022-11-01-preview or above."

Any workaround for this or any AZ modules that we need to update or add to the automation account?

Script :

Connect-AzAccount -Identity 

$contanierAppPropertybefore= Get-AzContainerApp -ResourceGroupName <RGName> -Name <ContainerAppName>

$scallingminvalues1 = $contanierAppPropertybefore.ScaleMinReplica

Update-AzContainerApp -ResourceGroupName <RGName> -Name <ContainerAppName>        - ScaleMinReplica 1

$contanierAppPropertyAfter= Get-AzContainerApp -ResourceGroupName <RGName> -Name <ContainerAppName>

$scallingminvalues2 = $contanierAppPropertyAfter.ScaleMinReplica

Write-Output = $scallingminvalues1

Write-Output = $scallingminvalues2
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,190 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,455 questions
Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
338 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dan Rios 1,815 Reputation points MVP
    2023-09-10T19:26:30.2133333+00:00

    Hey,

    Are both the QA and Production Azure Automation accounts running the latest Az.App module version 0.1.1? If not maybe Production needs to bump up to that one.

    https://www.powershellgallery.com/packages/Az.App/0.1.0

    0 comments No comments