title | description | ms.topic | ms.date | ms.custom | keywords |
---|---|---|---|---|---|
Azure CLI Script Example - Add an Application in Batch | Microsoft Docs |
Learn how to add an application for use with an Azure Batch pool or a task using the Azure CLI. |
sample |
05/24/2022 |
devx-track-azurecli, seo-azure-cli |
batch, azure cli samples, azure cli code samples, azure cli script samples |
This script demonstrates how to add an application for use with an Azure Batch pool or task. To set up an application to add to your Batch account, package your executable, together with any dependencies, into a zip file.
[!INCLUDE quickstarts-free-trial-note]
[!INCLUDE azure-cli-prepare-your-environment.md]
[!INCLUDE cli-launch-cloud-shell-sign-in.md]
:::code language="azurecli" source="~/azure_cli_scripts/batch/add-application/add-application.sh" id="FullScript":::
An application can reference multiple application executable packages of different versions. The executables and any dependencies need to be zipped up for the package. Once uploaded, the CLI attempts to activate the package so that it's ready for use.
az batch application package create \
--resource-group $resourceGroup \
--name $batchAccount \
--application-name "MyApplication" \
--package-file my-application-exe.zip \
--version-name 1.0
Update the application to assign the newly added application package as the default version.
az batch application set \
--resource-group $resourceGroup \
--name $batchAccount \
--application-name "MyApplication" \
--default-version 1.0
[!INCLUDE cli-clean-up-resources.md]
az group delete --name $resourceGroup
This script uses the following commands. Each command in the table links to command-specific documentation.
Command | Notes |
---|---|
az group create | Creates a resource group in which all resources are stored. |
az storage account create | Creates a storage account. |
az batch account create | Creates the Batch account. |
az batch account login | Authenticates against the specified Batch account for further CLI interaction. |
az batch application create | Creates an application. |
az batch application package create | Adds an application package to the specified application. |
az batch application set | Updates properties of an application. |
az group delete | Deletes a resource group including all nested resources. |
For more information on the Azure CLI, see Azure CLI documentation.