I tried finding some information on how to use Azure CLI in the cloud but there doesn't seem to be much available.
There are two versions of Azure CLI:
- v1.0
- Built as a node.js module
- Can be installed by running
npm install -g azure-cli
- v2.0
- Standalone package
- Install MSI on Windows or using some package manager, e.g. apt/yum/zyper/etc, on Linux.
Azure App Service
Azure Web Apps support running applications built ontop of node.js. Technically you could then install the v1.0 module in a Web App and run your script on a schedule there.
However, recommended is to use v2.0. But this would offere one possibility of automation.
Azure Automation
Current Azure CLI is not support but it's under review at the time of writing. See this link for the uservoice suggestion and vote on it if this a desired feature.
Azure Functions
As far as I can tell, there's no way to run Azure CLI on an Azure Function.
Azure Scheduler
Azure Scheduler is a service for only invoking code hosted elsewhere. This would still mean you need to host your code somewhere else, i.e. cloud or on-premises, then have the scheduler run it for you.
Triggering mechanisms that are supported are:
- HTTP, HTTPS
- Azure Storage queue
- Azure Service bus queue
- Azure Service bus topic
Azure Cloud Shell
It's a shell that contains tools needed for running commands and scripts without the needed to locally install anything. Scheduling anything, using cron does not seem to be possible.
Suggestion
At the moment, if you want to script something, and run it in the cloud, I recommend you have a look at PowerShell. Running PowerShell scripts, with a time trigger is possible on Azure Functions and support adding your own custom modules as well.
If you need to use Azure CLI and serverless, then you could run it inside of a Docker container and host the container in the cloud, e.g. in an Azure Container Instances. See this link on how to create it.