What’s the best Azure option for running a PowerShell script daily?

August 16, 2026 4 answers
Asked by muralist.ink
I've been developing a PowerShell script that needs to run once a day, and manually starting it every day doesn't seem practical. My organization is fully hosted in Azure, so I'm deciding between an Azure Automation runbook and an Azure Function App. Which option is the better fit for a scheduled PowerShell script? The script currently uses credentials to access REST APIs, so I'd also like to know whether either option can retrieve those credentials securely from Azure Key Vault instead of storing them directly in the script.

Answers

12 noon matinee
Both Azure Automation and Azure Functions can handle this. Functions are generally a better fit when the script is part of a broader application or needs to integrate with other services, while Automation runbooks are more natural for scheduled administrative PowerShell tasks. Either one can use a managed identity to access Key Vault.
Reply to this answer
SUNDAY REFEREE
A container with a scheduled job is another option if portability and maximum control matter. It can run the script in many environments, but it adds more operational work than Automation or Functions. For a simple daily PowerShell task in an Azure-only organization, I’d start with an Automation runbook and move to a container only if the script outgrows it.
Reply to this answer
voter_26B
Azure Automation is probably the most straightforward choice for this. Create an Automation account, enable its system-assigned managed identity, grant that identity permission to read the required Key Vault secrets, and retrieve them at runtime with the Az PowerShell cmdlets. That keeps the credentials out of the script and works well for a once-daily scheduled run.
Reply to this answer
_trailhead_map
You may not need Key Vault for every API. If the REST APIs are Azure or tenant services that support managed identities, assign the necessary roles or API permissions to the Automation account’s identity and request a token at runtime. For external APIs that require their own client secret, store that secret in Key Vault and allow the managed identity to read it.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions