英文:
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?
答案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。
结果:
英文:
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":
Then you create two runbooks under "Process Automation" section:
Using this PowerShell scripts:
runbook1 script for Weekdays
$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
runbook2 script for Weekends
$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
Don't forget to "save" and then "publish" the runbooks.
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:
In the True and False boxes search for "create job":
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
Results:
答案2
得分: 1
以下是要翻译的内容:
为了完整起见,在接下来的部分,配置在工作日的营业时间内将始终准备好的实例数量设置为3,在周末和非营业时间将始终准备好的实例数量设置为1:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论