- Articles
- How To Use Azure Automation To Make Its Operations Easier & Schedule Start & Stop For Logic & Function Apps
Microsoft Azure
How to use Azure Automation to make its operations easier and schedule Start and Stop for Logic and Function Apps

Managing cloud resources efficiently is essential for organisations aiming to optimise costs and improve operational workflows. Azure Automation, a robust cloud-based service from Microsoft Azure, provides the tools needed to automate routine tasks and streamline IT operations. Among its many capabilities, Azure Automation excels at scheduling the start and stop of Azure Logic Apps and Function Apps, enabling businesses to reduce unnecessary resource usage and lower costs without compromising performance.
In this article we’ll explore how Azure Automation simplifies these processes, its key features and how it helps organisations achieve greater control over their cloud infrastructure.
What is Azure Automation?
Azure Automation is a cloud-based service designed to automate repetitive and time-consuming tasks in IT management. It supports the management of both Azure resources and hybrid environments, allowing you to streamline administrative workflows using tools like PowerShell, Python and the Azure portal.
Azure Automation provides a range of capabilities that enable the automation of tasks such as:
- Resource provisioning
- Patching and updates
- Configuration management
- Incident response
- Scaling operations (i.e., autoscaling)
These capabilities reduce the chances of human error and free up IT teams to focus on higher-level tasks.
Key features of Azure Automation
Azure Automation offers a wide range of capabilities designed to improve IT operations, resource management and reduce manual intervention. These features enable organisations to optimise their cloud and hybrid environments while maintaining control, security and efficiency.
From automating routine tasks with runbooks to ensuring infrastructure compliance with configuration management, Azure Automation provides the tools needed to simplify complex workflows. Below, we explore the key features that make Azure Automation an essential solution:
Runbooks
At the heart of Azure Automation are runbooks. These are scripts that can be written in PowerShell, Python, or the Azure portal, designed to automate various tasks like VM management, data backups, or resource optimization. You can schedule these runbooks to run at specific times or trigger them in response to certain events.
Example: A runbook could automatically shut down virtual machines outside of business hours, saving on unnecessary cloud costs.
Update Management
Keeping your infrastructure secure and up to date can be a daunting task, especially across hybrid environments. Azure Automation’s Update Management feature helps to streamline patching by providing insights into which machines need updates and enabling automated patch deployments across Windows and Linux VMs.
Example: Configure Azure Automation to automatically apply critical patches to your VMs every Sunday at midnight, ensuring that your environment is always secure without manual intervention.
Configuration Management
Azure Automation includes desired state configuration (DSC), which ensures that machines in your environment maintain the correct configuration. DSC automatically detects and corrects any configuration drift, allowing your infrastructure to remain compliant with organizational standards.
Example: If a specific service is stopped on a machine, DSC can automatically restart the service to maintain compliance.
Process automation in hybrid environments
Azure Automation supports hybrid environments, which means you can automate processes not only within Azure but across on-premises data centers or even other cloud platforms. This is accomplished through Hybrid Runbook Workers, which allow automation tasks to execute on local servers or other environments outside of Azure.
Example: A Hybrid Runbook Worker can run a PowerShell script to automate file backups from on-premises servers to the cloud.
Monitoring and Alerts
Automation doesn’t mean blindly running scripts without oversight. Azure Automation integrates with Azure Monitor and Log Analytics to provide detailed monitoring, logging and alerting. You can monitor the status of your automation jobs, track execution details and set up alerts for failed jobs.
Example: Set up alerts to notify you when a scheduled automation job fails or completes with warnings.
Benefits of Azure Automation
Azure Automation offers a wealth of advantages for organizations looking to optimize their IT operations and reduce overhead. In this section, we’ll dive into the key benefits of Azure Automation, including cost savings, operational efficiency, increased security, scalability and its ability to integrate with hybrid cloud and on-premises environments. Let’s explore how these benefits can help transform your IT strategy:
1. Cost savings
By automating routine tasks, Azure Automation helps reduce manual effort and prevent unnecessary cloud spend. Automated processes such as scaling down idle resources can have a significant impact on your overall costs.
2. Operational efficiency
Automation eliminates human error and ensures consistency in how tasks are performed. This not only leads to more predictable outcomes but also reduces the time IT staff spend on repetitive tasks.
3. Increased security and compliance
With automated updates and configuration management, organizations can ensure that their infrastructure is always secure and compliant with regulatory standards. Azure Automation’s DSC and update management features make it easy to ensure that critical systems remain up to date.
4. Scalability
Azure Automation is a highly scalable service, meaning you can automate a few tasks for a small environment or manage an enterprise-wide IT landscape with thousands of resources. The flexibility of the platform ensures that it grows with your business.
5. Hybrid Cloud and on-prem integration
The ability to manage both Azure resources and on-premises infrastructure from a single platform allows organizations to maintain control over their entire IT environment, no matter where it resides.
Getting started with Azure Automation
Getting started with Azure Automation is a straightforward process, and with just a few steps, you can begin leveraging its capabilities to streamline your operations.
Here’s a quick overview of it:
- Set up an Azure Automation account:
Begin by creating an Automation account in the Azure portal, search for "Automation" and follow the steps to create a new automation account. This serves as the foundation for managing and executing your automation workflows. - Create a Runbook:
With your Automation account ready, you can start creating runbooks, scripts that perform specific tasks. Choose between PowerShell or Python to write your automation logic, depending on your team’s expertise and needs. - Configure Hybrid workers:
If you want to automate tasks in hybrid environments, you can set up Hybrid Runbook Workers to extend automation to your on-premises servers. - Schedule and Monitor jobs:
Use Azure Scheduler or event-based triggers to start runbooks automatically and monitor their progress using Azure Monitor.
Use Case: Scheduled start and stop for Logic and Function Apps

Figure 1. Scheduled start and stop for Logic and Function Apps.
In this use case, Azure Automation is leveraged to manage the operational schedules of Azure Logic Apps and Azure Function Apps by starting and stopping them at predefined times each day. This approach is especially useful for optimizing costs by ensuring that these resources are only running when required, such as during business hours or specific processing windows.
How It works: Components
Azure Automation orchestrates the entire process by executing scripts (runbooks) at predefined times. Here’s a simplified explanation of the components involved and the steps to implement this setup:
- Azure Automation: Serves as the backbone for this process by managing the automation workflows. Within Azure Automation, you’ll create two runbooks—one to start and another to stop the Logic and Function Apps.
- Runbooks: These are scripts (typically written in PowerShell) created in Azure Automation to execute start and stop actions on specified Logic and Function Apps. Runbooks can be configured to target specific apps, helping to scale operations based on workload demands.
- Scheduler Trigger: The Azure Scheduler (or automation-based schedule) is set up to trigger these runbooks on a daily basis. For example, the "start" runbook could be scheduled to trigger at the beginning of the workday, while the "stop" runbook triggers at the end of the day.
- Logic Apps and Function Apps: These are the core applications managed by the automation process. Logic Apps and Function Apps allow businesses to implement automated workflows and serverless functions but may incur costs when running continuously. By scheduling start and stop actions, organizations can manage these applications' availability and reduce costs effectively.
This setup enables businesses to automate the daily control of their serverless and workflow resources with minimal manual oversight, increasing efficiency and cost-effectiveness across the board.
Step-by-step guide to automating scheduled start and stop
To automate the daily start and stop of an Azure Function App using Azure Automation, follow these steps:
1. Create an Azure Automation Account:
- Log in to the Azure Portal.
- Navigate to "Automation Accounts" and create a new account if you don’t already have one.
- Ensure the account has appropriate permissions to manage your Logic and Function Apps.

Figure 2. Create an Azure Automation account.
2. Create a Runbook:
- In the Automation Account, go to the "Runbooks" section.
- Select Create a Runbook and choose "PowerShell" as the runbook type.

Figure 3. Create a runbook.
3. Define the Start and Stop Logic:
In the Runbook, write the PowerShell script to start and stop the Azure Function App. Here is an example script:
1param(
2 [string]$action,
3 [string]$resourceGroupName,
4 [string]$functionAppName
5 )
6
7 if ($action -eq "start") {
8 Start-AzFunctionApp -ResourceGroupName $resourceGroupName -Name $functionAppName
9 } elseif ($action -eq "stop") {
10 Stop-AzFunctionApp -ResourceGroupName $resourceGroupName -Name $functionAppName
11 } else {
12 Write-Output "Invalid action. Use 'start' or 'stop'."
13 }
4. Publish the Runbook:
- Save the script and click Publish in the Runbook editor.
- Test the runbook manually to ensure it starts and stops the apps as expected.

Figure 4. Run the Runbook
5. Create Schedules
In your Automation Account, navigate to the "Schedules" section.

Figure 5. Create Schedules
- Create two schedules:
- One for the start action (e.g., 8:00 AM).
- One for the stop action (e.g., 6:00 PM).
- Link these schedules to the runbook and pass the appropriate parameters (e.g., action = "start" or action = "stop").

Figure 6. Schedule to stop
6. Test and Monitor:
- Test the entire setup to confirm that the schedules correctly trigger the runbooks and the apps start and stop as expected.
- Use Azure Monitor to track runbook execution, detect any issues, and set up alerts if necessary.
By following these steps, you can automate the daily start and stop of your Azure Function App using Azure Automation.
Conclusion
Efficient resource management is essential for optimising cloud operations and controlling costs. With Azure Automation, you can easily schedule the start and stop of your Logic Apps and Function Apps, ensuring they run only when needed. This approach reduces unnecessary expenses, simplifies daily operations and enhances the management of your IT environment.
As an Azure Partner, we have extensive experience in designing and implementing automation solutions that align with your business goals. If you’re looking to optimise your Logic Apps and Function Apps with Azure Automation, contact us today. Our experts can help you design a tailored solution to improve efficiency, reduce costs and get the most out of your Azure environment.
Related Articles
Catch up on the latest news, articles, guides and opinions from Claria.