|
| 1 | +--- |
| 2 | +title: Create an Azure Compute Fleet using Azure CLI |
| 3 | +description: Learn how to create an Azure Compute Fleet using Azure CLI. |
| 4 | +author: ykh015 |
| 5 | +ms.author: yakhande |
| 6 | +ms.topic: how-to |
| 7 | +ms.service: azure-compute-fleet |
| 8 | +ms.date: 05/09/2025 |
| 9 | +ms.reviewer: jushiman |
| 10 | +ms.custom: devx-track-arm-template, build-2024 |
| 11 | +--- |
| 12 | + |
| 13 | +# Create an Azure Compute Fleet using Azure CLI |
| 14 | + |
| 15 | +This article steps through using an ARM template to create an Azure Compute Fleet. |
| 16 | + |
| 17 | + |
| 18 | +[!INCLUDE [About Azure Resource Manager](~/reusable-content/ce-skilling/azure/includes/resource-manager-quickstart-introduction.md)] |
| 19 | + |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +- If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin. |
| 24 | +- Before using Compute Fleet, complete the feature registration and configure role-based access controls (RBAC). |
| 25 | + |
| 26 | + |
| 27 | +## Feature registration |
| 28 | + |
| 29 | +Register the Azure Compute Fleet resource provider with your subscription using Azure CLI. Registration can take up to 30 minutes to successfully show as registered. |
| 30 | + |
| 31 | +```bash |
| 32 | +az provider register --namespace 'Microsoft.AzureFleet' |
| 33 | +``` |
| 34 | + |
| 35 | +### [Azure portal](#tab/portal-1) |
| 36 | + |
| 37 | +1. In the [Azure portal](https://portal.azure.com), navigate to your subscriptions. |
| 38 | +1. Select the subscription you want to enable Azure Compute Fleet on. |
| 39 | +1. Under **Settings**, select **Resource providers**. |
| 40 | +1. Search for *Microsoft.AzureFleet* and register the provider. |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | + |
| 45 | +## Role-based access control permissions |
| 46 | + |
| 47 | +Assign the appropriate RBAC permissions to use Azure Compute Fleet. |
| 48 | + |
| 49 | +1. In the [Azure portal](https://portal.azure.com), navigate to your subscriptions. |
| 50 | +1. Select the subscription you want to adjust RBAC permissions. |
| 51 | +1. Select **Access Control (IAM)**. |
| 52 | +1. Select *Add*, then **Add Role Assignment**. |
| 53 | +1. Search for **Virtual Machine Contributor** and highlight it. Select **Next**. |
| 54 | +1. Click on **+ Select Members**. |
| 55 | +1. Search for *Azure Fleet Resource Provider* role. |
| 56 | +1. Select the *Azure Fleet Resource Provider* and select **Review + Assign**. |
| 57 | +1. Repeat the previous steps for the *Network Contributor* role and the *Managed Identity Operator* role. |
| 58 | + |
| 59 | +If you're using images stored in Compute Gallery when deploying your Compute Fleet, also repeat the previous steps for the *Compute Gallery Sharing Admin* role. |
| 60 | + |
| 61 | +For more information on assigning roles, see [assign Azure roles using the Azure portal](../role-based-access-control/quickstart-assign-role-user-portal.md). |
| 62 | + |
| 63 | + |
| 64 | +## ARM template |
| 65 | + |
| 66 | +[!INCLUDE [About Azure Resource Manager](~/reusable-content/ce-skilling/azure/includes/resource-manager-quickstart-introduction.md)] |
| 67 | + |
| 68 | +ARM templates let you deploy groups of related resources. In a single template, you can create the Virtual Machine Scale Set, install applications, and configure autoscale rules. With the use of variables and parameters, this template can be reused to update existing, or create extra scale sets. You can deploy templates through the Azure portal, Azure CLI, or Azure PowerShell, or from continuous integration / continuous delivery (CI/CD) pipelines. |
| 69 | + |
| 70 | + |
| 71 | +## Review the template |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +These resources are defined in the template: |
| 76 | + |
| 77 | +- [**Microsoft.Network/virtualNetworks**](/azure/templates/microsoft.network/virtualnetworks) |
| 78 | +- [**Microsoft.Network/loadBalancers**](/azure/templates/microsoft.network/loadbalancers) |
| 79 | + |
| 80 | + |
| 81 | +## Clean up resources |
| 82 | + |
| 83 | +When no longer needed, you can use [az group delete](/cli/azure/group) to remove the resource group, scale set, and all related resources as follows. The `--no-wait` parameter returns control to the prompt without waiting for the operation to complete. The `--yes` parameter confirms that you wish to delete the resources without another prompt to do so. |
| 84 | + |
| 85 | +```azurecli-interactive |
| 86 | +az group delete --name myResourceGroup --yes --no-wait |
| 87 | +``` |
| 88 | + |
| 89 | +## Next steps |
| 90 | +> [!div class="nextstepaction"] |
| 91 | +> [Create an Azure Compute Fleet with Azure portal.](quickstart-create-portal.md) |
0 commit comments