Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

huangapple go评论65阅读模式
英文:

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

问题

我正在尝试使用Azure Logic App创建一个自动化流程,以在周末将始终准备好的实例数量设置为1,并在工作日恢复为3。请注意,我的函数应用托管在弹性高级计划EP1中。我一直在努力解决这个任务,但最终未能解决。此外,我没有找到任何有关创建此自动化的文档。您知道是否有可能实现这个吗?

英文:

I'm trying to use Azure Logic App to create an automation that sets the number of always ready instances to 1 during weekends and back to 3 during working days.
Note that my function app is hosted in an Elastic Premium Plan EP1.
I have been struggling on this task but at the end I was not able to solve it. Also I didn't find any documentation for creating this automation.
Do you have any idea if it is possible to do this?

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

答案1

得分: 1

以下是您要翻译的内容:

在我这一端进行复制后,我可以使用Azure自动化帐户完成此操作。我已在Logic Apps中设置了所需的天数,并调用了以下基于日期执行的脚本。

首先,从控制台中导航到“自动化帐户”服务,如果您还没有自动化帐户,请按“创建”按钮创建一个:

然后,在“过程自动化”部分下创建两个运行簿:

使用此PowerShell脚本:

工作日的运行簿1脚本

$resourceGroupName = "<YOUR_RESOURCE_GROUP>"
$functionApp = "<FUNCTION_APP>"

$Resource = Get-AzResource -ResourceGroupName $resourceGroupName -ResourceName $functionApp/config/web -ResourceType Microsoft.Web/sites
$Resource.Properties.minimumElasticInstanceCount = 3
$Resource | Set-AzResource -Force

周末的运行簿2脚本

$resourceGroupName = "<YOUR_RESOURCE_GROUP>"
$functionApp = "<FUNCTION_APP>"

$Resource = Get-AzResource -ResourceGroupName $resourceGroupName -ResourceName $functionApp/config/web -ResourceType Microsoft.Web/sites
$Resource.Properties.minimumElasticInstanceCount = 1
$Resource | Set-AzResource -Force

不要忘记“保存”然后“发布”运行簿。

然后,从控制台中导航到Logic Apps服务并创建一个新实例,然后转到“逻辑应用设计器”。
这是我的逻辑应用流程:

在True和False框中搜索“create job”:

请注意,创建作业时,您将需要使用可用的身份验证方法之一进行身份验证,我选择了“OAuth默认”,然后您只需粘贴tenantID

结果:

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

英文:

After reproducing from my end, I could get this done using Azure Automation Account. I have set the days that I wanted in Logic Apps and made a call to execute the below script based on the day.

First of all navigate to the "Automation Accounts" service from the console, if you don't have any automation accounts yet, create one pressing the button "create":

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

Then you create two runbooks under "Process Automation" section:

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

Using this PowerShell scripts:

runbook1 script for Weekdays

$resourceGroupName = &quot;&lt;YOUR_RESOURCE_GROUP&gt;&quot;
$functionApp = &quot;&lt;FUNCTION_APP&gt;&quot;

$Resource = Get-AzResource -ResourceGroupName $resourceGroupName -ResourceName $functionApp/config/web -ResourceType Microsoft.Web/sites
$Resource.Properties.minimumElasticInstanceCount = 3
$Resource | Set-AzResource -Force

runbook2 script for Weekends

$resourceGroupName = &quot;&lt;YOUR_RESOURCE_GROUP&gt;&quot;
$functionApp = &quot;&lt;FUNCTION_APP&gt;&quot;

$Resource = Get-AzResource -ResourceGroupName $resourceGroupName -ResourceName $functionApp/config/web -ResourceType Microsoft.Web/sites
$Resource.Properties.minimumElasticInstanceCount = 1
$Resource | Set-AzResource -Force

Don't forget to "save" and then "publish" the runbooks.

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

Then navigate to Logic apps service from the console and create a new instance, then go to "logic apps designer".
Here is the flow of my logic app:

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

In the True and False boxes search for "create job":

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

Note that when you create the job, you will need to authenticate using one of the available authentication methodologies, I have selected "OAuth default", then you simply paste the tenantID

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

Results:

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

答案2

得分: 1

以下是要翻译的内容:

为了完整起见,在接下来的部分,配置在工作日的营业时间内将始终准备好的实例数量设置为3,在周末和非营业时间将始终准备好的实例数量设置为1:

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

英文:

For the sake of completeness, in the following, a configuration that sets the number of always ready instances to 3 during business hours of week days, and 1 always ready instance during weekend days and out of business hours:

Azure Logic Apps for changing the number of Always Ready Instances of my Function App (Elastic Premium Plan EP1)

huangapple
  • 本文由 发表于 2023年5月25日 21:25:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76332815.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定