Skip to content

Commit 926ea7d

Browse files
Merge pull request #113378 from dlepow/acrtape
[ACR] Task agent pool
2 parents 34ba3a9 + 107500e commit 926ea7d

File tree

3 files changed

+187
-1
lines changed

3 files changed

+187
-1
lines changed

articles/container-registry/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@
189189
href: container-registry-tasks-authentication-key-vault.md
190190
- name: Quick task run with Resource Manager template
191191
href: container-registry-task-run-template.md
192+
- name: Run task on dedicated agent pool (preview)
193+
href: container-registry-tasks-agent-pools.md
192194
- name: Build image with Buildpacks (preview)
193195
href: container-registry-tasks-pack-build.md
194196
- name: View task logs
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
---
2+
title: Use dedicated pool to run task - Tasks
3+
description: Set up a dedicated compute pool (agent pool) in your registry to run an Azure Container Registry task.
4+
ms.topic: article
5+
ms.date: 04/30/2020
6+
---
7+
8+
# Run an ACR task on a dedicated agent pool
9+
10+
Set up an Azure-managed VM pool (*agent pool*) to enable running your [Azure Container Registry tasks][acr-tasks] in a dedicated compute environment. After you've configured one or more pools in your registry, you can choose a pool to run a task in place of the service's default compute environment.
11+
12+
An agent pool provides:
13+
14+
- **Virtual network support** - Assign an agent pool to an Azure VNet, providing access to resources in the VNet such as a container registry, key vault, or storage.
15+
- **Scale as needed** - Increase the number of instances in an agent pool for compute-intensive tasks, or scale to zero. Billing is based on allocation.
16+
- **Flexible options** - Choose from different [pool tiers](#pool-tiers) and scale options to meet your task workload needs.
17+
- **Azure management** - Task pools are patched and maintained by Azure, providing reserved allocation without the need to maintain the individual VMs.
18+
19+
This feature is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry SKUs][acr-tiers].
20+
21+
> [!IMPORTANT]
22+
> This feature is currently in preview, and some [limitations apply](#preview-limitations). Previews are made available to you on the condition that you agree to the [supplemental terms of use][terms-of-use]. Some aspects of this feature may change prior to general availability (GA).
23+
>
24+
25+
## Preview limitations
26+
27+
- Task agent pools currently support Linux nodes. Windows nodes are not currently supported.
28+
- Task agent pools are available in preview in the following regions: West US 2, South Central US, East US 2, and East US.
29+
- For each registry, the default total vCPU (core) quota for all agent pools is 16. Open a [support request][open-support-ticket] for additional allocation.
30+
31+
## Prerequisites
32+
33+
* To use the Azure CLI steps in this article, Azure CLI version 2.3.1 or later is required. If you need to install or upgrade, see [Install Azure CLI][azure-cli]. Or run in [Azure Cloud Shell](../cloud-shell/quickstart.md).
34+
* If you don't already have a container registry, [create one][create-reg-cli] (Premium tier required) in a preview region.
35+
36+
## Pool tiers
37+
38+
Agent pool tiers provide the following resources per instance in the pool.
39+
40+
|Tier |CPU |Memory (GB) |
41+
|---------|---------|---------|
42+
|S1 | 2 | 3 |
43+
|S2 | 4 | 8 |
44+
|S3 | 8 | 16 |
45+
46+
## Create and manage a task agent pool
47+
48+
### Set default registry (optional)
49+
50+
To simplify Azure CLI commands that follow, set the default registry by running the [az configure][az-configure] command:
51+
52+
```azurecli
53+
az configure --defaults acr=<registryName>
54+
```
55+
56+
The following examples assume that you've set the default registry. If not, pass a `--registry <registryName>` parameter in each `az acr` command.
57+
58+
### Create agent pool
59+
60+
Create an agent pool by using the [az acr agentpool create][az-acr-agentpool-create] command. The following example creates a tier S2 pool (4 CPU/instance). By default, the pool contains 1 instance.
61+
62+
```azurecli
63+
az acr agentpool create \
64+
--name myagentpool \
65+
--tier S2
66+
```
67+
68+
Creating an agent pool and other pool management operations will take several minutes to complete.
69+
70+
### Scale pool
71+
72+
Scale the pool size up or down with the [az acr agentpool update][az-acr-agentpool-update] command. The following example scales the pool to 2 instances. You can scale to 0 instances.
73+
74+
```azurecli
75+
az acr agentpool update \
76+
--name myagentpool \
77+
--count 2
78+
```
79+
80+
## Create pool in a virtual network
81+
82+
### Add firewall rules
83+
84+
Task agent pools require access to the following Azure services. The following firewall rules must be added to any existing network security groups or user-defined routes.
85+
86+
| Direction | Protocol | Source | Source Port | Destination | Dest Port | Used |
87+
|-----------|----------|----------------|-------------|----------------------|-----------|---------|
88+
| Outbound | TCP | VirtualNetwork | Any | Storage | 443 | Default |
89+
| Outbound | TCP | VirtualNetwork | Any | EventHub | 443 | Default |
90+
| Outbound | TCP | VirtualNetwork | Any | AzureActiveDirectory | 443 | Default |
91+
| Outbound | TCP | VirtualNetwork | Any | AzureMonitor | 443 | Default |
92+
93+
> [!NOTE]
94+
> If your tasks require additional resources from the public internet, add the corresponding rules. For example, these rules are needed if you run a docker build task that needs to pull the base images from Docker Hub, or restores a NuGet package.
95+
96+
### Create pool in VNet
97+
98+
The following example creates an agent pool in the *mysubnet* subnet of network *myvnet*:
99+
100+
```azurecli
101+
# Get the subnet ID
102+
subnetId=$(az network vnet subnet show \
103+
--resource-grop myresourcegroup \
104+
--vnet-name myvnet \
105+
--name mysubnetname \
106+
--query id --output tsv)
107+
108+
az acr agentpool create \
109+
--name myagentpool \
110+
--tier S2 \
111+
--subnet-id $subnetId
112+
```
113+
114+
## Run task on agent pool
115+
116+
The following examples show how to specify an agent pool when queuing a task.
117+
118+
> [!NOTE]
119+
> To use an agent pool in an ACR task, ensure that the pool contains at least 1 instance.
120+
>
121+
122+
### Quick task run
123+
124+
Queue a quick run on the agent pool by using the [az acr build][az-acr-build] command and pass the `--agent-pool` parameter:
125+
126+
```azurecli
127+
az acr build \
128+
--agent-pool myagentpool \
129+
--image myimage:mytag \
130+
--file Dockerfile \
131+
https://github.com/Azure-Samples/acr-build-helloworld-node.git
132+
```
133+
134+
### Automatically triggered task
135+
136+
For example, create a scheduled task on the agent pool with [az acr task create][az-acr-task-create], passing the `--agent-pool` parameter.
137+
138+
```azurecli
139+
az acr task create \
140+
--name mytask \
141+
--agent-pool myagentpool \
142+
--image myimage:mytag \
143+
--schedule "0 21 * * *" \
144+
--file Dockerfile \
145+
--context https://github.com/Azure-Samples/acr-build-helloworld-node.git \
146+
--commit-trigger-enabled false
147+
```
148+
149+
To verify task setup, run [az acr task run][az-acr-task-run]:
150+
151+
```azurecli
152+
az acr task run \
153+
--name mytask
154+
```
155+
156+
### Query pool status
157+
158+
To find the number of runs currently scheduled on the agent pool, run [az acr agentpool show][az-acr-agentpool-show].
159+
160+
```azurecli
161+
az acr agentpool show \
162+
--name myagentpool \
163+
--queue-count
164+
```
165+
166+
## Next steps
167+
168+
For more examples of container image builds and maintenance in the cloud, check out the [ACR Tasks tutorial series](container-registry-tutorial-quick-task.md).
169+
170+
171+
172+
[acr-tasks]: container-registry-tasks-overview.md
173+
[acr-tiers]: container-registry-skus.md
174+
[azure-cli]: /cli/azure/install-azure-cli
175+
[open-support-ticket]: https://aka.ms/acr/support/create-ticket
176+
[terms-of-use]: https://azure.microsoft.com/support/legal/preview-supplemental-terms/
177+
[az-configure]: /cli/azure#az-configure
178+
[az-acr-agentpool-create]: /cli/azure/acr/agentpool#az-acr-agentpool-create
179+
[az-acr-agentpool-update]: /cli/azure/acr/agentpool#az-acr-agentpool-update
180+
[az-acr-agentpool-show]: /cli/azure/acr/agentpool#az-acr-agentpool-show
181+
[az-acr-build]: /cli/azure/acr#az-acr-build
182+
[az-acr-task-create]: /cli/azure/acr/task#az-acr-task-create
183+
[az-acr-task-run]: /cli/azure/acr/task#az-acr-task-run
184+
[create-reg-cli]: container-registry-get-started-azure-cli.md

articles/container-registry/container-registry-vnet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ If instead you need to set up access rules for resources to reach a container re
2424

2525
* Only an [Azure Kubernetes Service](../aks/intro-kubernetes.md) cluster or Azure [virtual machine](../virtual-machines/linux/overview.md) can be used as a host to access a container registry in a virtual network. *Other Azure services including Azure Container Instances aren't currently supported.*
2626

27-
* [ACR Tasks](container-registry-tasks-overview.md) operations aren't currently supported in a container registry accessed in a virtual network.
27+
* Running [ACR Tasks](container-registry-tasks-overview.md) in a container registry accessed in a virtual network requires a [dedicated agent pool](container-registry-tasks-agent-pools.md).
2828

2929
* Each registry supports a maximum of 100 virtual network rules.
3030

0 commit comments

Comments
 (0)