and when you add Azure Timer Function you will see it is setup (0 */5 * * * *”) to run after every 5 minutes. But we need to configure it to run on the first day of every month so we will set it like (0 0 0 1 * *). After changing expression like this if you will run Azure Function from visual studio you will be able to see the next 5 occurrence information like following,
Note
Before running Azure Function make sure to setup RunOnStartup = false to see these details. Also before deploying your Azure Function to Azure make sure to setup this to false otherwise it will run once as soon as Azure Function Service is started in Azure.
So we have configured timer expression so let's deploy our Azure Function to Azure portal.
- Right click on the project and select Publish.
- Select Create New and click on Create Profile button.
- In the next screen we need to create App Service so first make sure you are logged in to Azure using your valid user and later you can fill in the details of the App service dialog. If you have already created Azure Resource group, Hosting plans, Storage account, you can select them otherwise you can create them by clicking on New button. Once all details are selected click on Create to create app service.
Once App Service is created, you will be redirected to the Publish screen like following,
Click on Publish to publish your Azure Function App service.
Once the publish process is completed you can navigate to Azure Portal and check Resource Group, you should be able to see a new Azure Function App service created like the following,
When you click on the Azure Function App Service, you will notice it is read only.
So use following the steps to make it non read only.
- Navigate to Platform Features from Azure function app and click on App Service Editor under development tools.
- Remove this first line and close App Service Editor.
Now our Azure Function app service is not read only and it will run based on the schedule.
Summary
In this article we learned how we can integrate Azure with Dynamics 365 CE and can built scheduler for Dynamics 365 CE. Keep in mind by default Azure app service consumption plan offers 10 min timeout limit, if your logic is going to take more then 10 minute you need to buy a higher plan. You can get more details about Azure function subscription from the below KB.
https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-subscription-service-limits#functions-limits