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

Are your Azure Logic Apps and Azure Functions running longer than needed and costing more than they should? If so, you're not alone. Many organisations leave cloud resources running by default, resulting in unnecessary expenses and inefficiencies. Fortunately, there's a practical way to take control.
Azure Automation is a cloud-based service from Microsoft that allows IT teams to automate repetitive, manual tasks and manage complex processes more effectively. One of its most valuable features is the ability to schedule when Azure Logic Apps and Azure Functions start and stop. This capability not only improves cost control but also reduces the burden on IT teams, freeing them to focus on strategic work.
In this article, we’ll guide you through how Azure Automation works, its key features and a step-by-step approach to scheduling Azure Logic Apps and Functions operations. Here you'll find actionable insights to make your infrastructure smarter and more cost-effective.
What is Azure Automation?
Azure Automation is a cloud-based service designed to automate repetitive and time-consuming tasks in IT management. It supports various automation methods, including runbooks (scripted workflows), configuration management, update management and hybrid worker capabilities. With support for PowerShell and Python, Azure Automation gives organisations the flexibility to build and manage workflows suited to their specific needs.
Common tasks automated with Azure Automation:
- Resource provisioning
- Patching and updates
- Configuration management
- Incident response
- Scaling operations (i.e., autoscaling)
By automating these tasks, organisations can maintain better control over their IT environment while minimising human error.
Key Features of Azure Automation
Below, we explore the key features that make Azure Automation an essential solution:
Runbooks
Runbooks are the core automation scripts in Azure Automation. They can be scheduled or triggered and written in PowerShell, Python, or through the graphical interface. A runbook might, for instance, shut down non-critical services outside office hours to avoid idle costs.
Update management
Azure Automation helps maintain up-to-date systems by detecting and deploying updates across environments. Azure Automation’s Update Management feature helps improve patching by providing insights into which machines need updates and enabling automated patch deployments across Windows and Linux VMs.
This ensures consistency, improves security posture and supports compliance initiatives.
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 organisational standards.
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.
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.
How to set up Azure Automation for Cloud cost optimisation
Azure Automation is accessible and practical, allowing teams to begin automating common tasks with just a few configuration steps. Here’s how to start using it effectively:
Step 1: Create an Azure Automation account
Begin by creating an Automation account in the Azure portal. Search for "Automation" and follow the prompts to create a new automation account. This serves as the foundation for managing and executing your automation workflows.
Step 2: Build a Runbook to automate tasks
Once your Automation Account is in place, navigate to the "Runbooks" section and select "Create a Runbook." You’ll be prompted to choose a name and a scripting language (typically PowerShell or Python). This is where you define the logic for your automated tasks.
Step 3: Configure Hybrid Workers (For on-prem and cross-cloud automation)
If you plan to automate tasks across hybrid environments, such as on-premises servers or systems outside of Azure, configure Hybrid Runbook Workers. These allow your automation scripts to execute on machines that reside outside the Azure platform.
Step 4: Set Schedules and Monitor jobs
To automate execution, link your runbooks to schedules or event-based triggers. Use Azure Monitor to track job execution, view logs and receive alerts for any issues. This ensures that your automation runs reliably and that potential problems are flagged early.
Use case: Automatically start and stop Azure Logic Apps and Azure Functions
In this use case, Azure Automation is managing when Azure Logic Apps and Azure Functions run. These services can incur costs when left active unnecessarily. Automating their start and stop times ensures they only operate during defined periods, such as business hours, thereby saving costs and improving operational control.
Figure 1. Scheduled start and stop for Azure Logic and Function Apps.
Key Components of the scheduled Start/Stop solution
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 account: Acts as the command centre for all automation activity. 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.
- Azure Logic Apps and Functions: These are the core applications managed by the automation process. Azure Logic Apps and Functions allow businesses to implement automated workflows and serverless functions but may incur costs when running continuously. By scheduling start and stop actions, organisations can manage these applications' availability and reduce costs effectively.
This approach enables precise control over serverless resources without requiring ongoing manual intervention.
Tutorial: How to automate Start and Stop Times with Azure Runbooks
To automate the daily start and stop of an Azure Function App using Azure Automation, follow these steps:
Step 1: Create an Azure Automation Account
- Open the Azure Portal.
- Navigate to "Automation Accounts."
- Create a new account with access permissions for your Azure Logic Apps and Functions.
Figure 2. Create an Azure Automation account.
Step 2: Create a Runbook
- In your Automation Account, go to "Runbooks."
- Click "Create a Runbook."
- Choose "PowerShell" as the scripting language.
Figure 3. Create a runbook.
Step 3: Define the Start and Stop Logic, write the Runbook Script
Use the following script as a template to start or stop your Azure Function App:
1 param(
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 }
Step 4: Publish and test the Runbook
- Save the script and click Publish in the Runbook editor.
- Test it manually by entering the required parameters and confirming it performs the correct action.
Figure 4. Run the Runbook
Step 5: Create and Link Schedules to Runbooks
- In your Automation Account, go to the "Schedules" section.
Figure 5. Create Schedules
- Create two schedules:
- One for starting the apps (e.g. 8:00 AM).
- One for stopping them (e.g. 6:00 PM).
- Link these schedules to the runbook with the appropriate parameters. (e.g.,
action = "start" or action = "stop"
).
Figure 6. Schedule to stop
Step 6: Monitor and Receive Alerts for Automation Jobs
- Use Azure Monitor to track whether the runbooks are executing as planned.
- Set up alerts to notify you in case of any failure or anomalies.
By following these steps, organisations can reliably automate the operation of their serverless applications, ensuring efficiency, reducing costs and maintaining greater control over their Azure resources.
Conclusion
Using Azure Automation to schedule and control Azure Logic Apps and Functions is a practical way to optimise your Azure environment. It reduces unnecessary spend, adds predictability to operations and lessens the load on IT teams by removing repetitive manual tasks. By implementing structured automation with runbooks and scheduling, organisations can gain more oversight and improve the way cloud resources are used.
If you're ready to improve your Azure cost efficiency and operational control through automation, we’re here to help. As a trusted Azure partner, we offer personalised guidance and implementation support to make your automation strategy a success. Get in touch with our team today to explore how we can help you achieve better outcomes with Azure Automation.
Related Articles
Catch up on the latest news, articles, guides and opinions from Claria.