|
| 1 | +--- |
| 2 | +title: Create a job with Azure Container Apps using the Azure portal |
| 3 | +description: Learn to create an on-demand or scheduled job in Azure Container Apps using the Azure portal |
| 4 | +services: container-apps |
| 5 | +author: craigshoemaker |
| 6 | +ms.service: container-apps |
| 7 | +ms.custom: build-2023, devx-track-azurecli |
| 8 | +ms.topic: quickstart |
| 9 | +ms.date: 08/21/2023 |
| 10 | +ms.author: cshoe |
| 11 | +--- |
| 12 | + |
| 13 | +# Create a job with Azure Container Apps using the Azure portal |
| 14 | + |
| 15 | +Azure Container Apps [jobs](jobs.md) allow you to run containerized tasks that execute for a finite duration and exit. You can trigger a job manually, schedule their execution, or trigger their execution based on events. |
| 16 | + |
| 17 | +Jobs are best suited to for tasks such as data processing, machine learning, or any scenario that requires on-demand processing. |
| 18 | + |
| 19 | +In this quickstart, you create a scheduled job. To learn how to create an event-driven job, see [Deploy an event-driven job with Azure Container Apps](tutorial-event-driven-jobs.md). |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +An Azure account with an active subscription is required. If you don't already have one, you can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). Also, please make sure to have the Resource Provider "Microsoft.App" registered. |
| 24 | + |
| 25 | +## Setup |
| 26 | + |
| 27 | +Begin by signing in to the [Azure portal](https://portal.azure.com). |
| 28 | + |
| 29 | +## Create a container app |
| 30 | + |
| 31 | +To create your Container Apps job, start at the Azure portal home page. |
| 32 | + |
| 33 | +1. Search for **Container App Jobs** in the top search bar. |
| 34 | +1. Select **Container App Jobs** in the search results. |
| 35 | +1. Select the **Create** button. |
| 36 | + |
| 37 | +### Basics tab |
| 38 | + |
| 39 | +In the *Basics* tab, do the following actions. |
| 40 | + |
| 41 | +1. Enter the following values in the *Project details* section. |
| 42 | + |
| 43 | + | Setting | Action | |
| 44 | + |---|---| |
| 45 | + | Subscription | Select your Azure subscription. | |
| 46 | + | Resource group | Select **Create new** and enter **jobs-quickstart**. | |
| 47 | + | Container job name | Enter **my-job**. | |
| 48 | + |
| 49 | +#### Create an environment |
| 50 | + |
| 51 | +Next, create an environment for your container app. |
| 52 | + |
| 53 | +1. Select the appropriate region. |
| 54 | + |
| 55 | + | Setting | Value | |
| 56 | + |--|--| |
| 57 | + | Region | Select **Central US**. | |
| 58 | + |
| 59 | +1. In the *Create Container Apps environment* field, select the **Create new** link. |
| 60 | +1. In the *Create Container Apps Environment* page, on the *Basics* tab, enter the following values: |
| 61 | + |
| 62 | + | Setting | Value | |
| 63 | + |--|--| |
| 64 | + | Environment name | Enter **my-environment**. | |
| 65 | + | Type | Enter **Workload Profile**. | |
| 66 | + | Zone redundancy | Select **Disabled** | |
| 67 | + |
| 68 | +1. Select the **Create** button at the bottom of the *Create Container App Environment* page. |
| 69 | + |
| 70 | +### Deploy the job |
| 71 | + |
| 72 | +1. In *Job details*, select **Scheduled** for the *Trigger type*. |
| 73 | + |
| 74 | + In the *Cron expression* field, enter `*/1 * * * *`. |
| 75 | + |
| 76 | + This expression starts the job every minute. |
| 77 | + |
| 78 | +1. Select the **Next: Container** button at the bottom of the page. |
| 79 | + |
| 80 | +1. In the *Container* tab, enter the following values: |
| 81 | + |
| 82 | + | Setting | Value | |
| 83 | + |--|--| |
| 84 | + | Name | Enter **main-container**. | |
| 85 | + | Image source | Select **Docker Hub or other registries**. | |
| 86 | + | Image type | Select **Public**. | |
| 87 | + | Registry login server | Enter **mcr.microsoft.com**. | |
| 88 | + | Image and tag | Enter **k8se/quickstart-jobs:latest**. | |
| 89 | + | Workload profile | Select **Consumption**. | |
| 90 | + | CPU and memory | Select **0.25** and **0.5Gi**. | |
| 91 | + |
| 92 | +1. Select the **Review and create** button at the bottom of the page. |
| 93 | + |
| 94 | + As the settings in the job are verified, if no errors are found, the *Create* button is enabled. |
| 95 | + |
| 96 | + Any errors appear on a tab marked with a red dot. If you encounter errors, navigate to the appropriate tab and you'll find fields containing errors highlighted in red. Once all errors are fixed, select **Review and create** again. |
| 97 | + |
| 98 | +1. Select **Create**. |
| 99 | + |
| 100 | + A page with the message *Deployment is in progress* is displayed. Once the deployment is successfully completed, you'll see the message: *Your deployment is complete*. |
| 101 | + |
| 102 | +### Verify deployment |
| 103 | + |
| 104 | +1. Select **Go to resource** to view your new Container Apps job. |
| 105 | + |
| 106 | +2. Select the **Execution history** tab. |
| 107 | + |
| 108 | + The *Execution history* tab displays the status of each job execution. Select the **Refresh** button to update the list. Wait up to a minute for the scheduled job execution to start. Its status changes from *Pending* to *Running* to *Succeeded*. |
| 109 | + |
| 110 | +1. Select **View logs**. |
| 111 | + |
| 112 | + The logs show the output of the job execution. It may take a few minutes for the logs to appear. |
| 113 | + |
| 114 | +## Clean up resources |
| 115 | + |
| 116 | +If you're not going to continue to use this application, you can delete the Azure Container Apps instance and all the associated services by removing the resource group. |
| 117 | + |
| 118 | +1. Select the **jobs-quickstart** resource group from the *Overview* section. |
| 119 | +1. Select the **Delete resource group** button at the top of the resource group *Overview*. |
| 120 | +1. Enter the resource group name **jobs-quickstart** in the *Are you sure you want to delete "jobs-quickstart"* confirmation dialog. |
| 121 | +1. Select **Delete**. |
| 122 | + The process to delete the resource group may take a few minutes to complete. |
| 123 | + |
| 124 | +> [!TIP] |
| 125 | +> Having issues? Let us know on GitHub by opening an issue in the [Azure Container Apps repo](https://github.com/microsoft/azure-container-apps). |
| 126 | +
|
| 127 | +## Next steps |
| 128 | + |
| 129 | +> [!div class="nextstepaction"] |
| 130 | +> [Container Apps jobs](jobs.md) |
0 commit comments