Create and manage custom locations on Azure Arc-enabled Kubernetes
The custom locations feature provides a way for tenant or cluster administrators to configure their Azure Arc-enabled Kubernetes clusters as target locations for deploying instances of Azure offerings. Examples of Azure offerings that can be deployed on top of custom locations include databases, such as Azure Arc-enabled SQL Managed Instance and Azure Arc-enabled PostgreSQL Hyperscale, or application instances, such as App Services, Functions, Event Grid, Logic Apps, and API Management.
A custom location has a one-to-one mapping to a namespace within the Azure Arc-enabled Kubernetes cluster. The custom location Azure resource combined with Azure role-based access control (Azure RBAC) can be used to grant granular permissions to application developers or database admins, enabling them to deploy resources such as databases or application instances on top of Arc-enabled Kubernetes clusters in a multi-tenant manner.
A conceptual overview of this feature is available in Custom locations - Azure Arc-enabled Kubernetes.
In this article, you learn how to:
- Enable custom locations on your Azure Arc-enabled Kubernetes cluster.
- Create a custom location.
Prerequisites
Install or upgrade Azure CLI to version >= 2.16.0.
Install the following Azure CLI extensions:
connectedk8s(version 1.2.0 or later)k8s-extension(version 1.0.0 or later)customlocation(version 0.1.3 or later)az extension add --name connectedk8s az extension add --name k8s-extension az extension add --name customlocationIf you have already installed the
connectedk8s,k8s-extension, andcustomlocationextensions, update to the latest version by using the following command:az extension update --name connectedk8s az extension update --name k8s-extension az extension update --name customlocation
Verify completed provider registration for
Microsoft.ExtendedLocation.Enter the following commands:
az provider register --namespace Microsoft.ExtendedLocationMonitor the registration process. Registration may take up to 10 minutes.
az provider show -n Microsoft.ExtendedLocation -o tableOnce registered, the
RegistrationStatestate will have theRegisteredvalue.
Verify you have an existing Azure Arc-enabled Kubernetes connected cluster.
- Upgrade your agents to version 1.5.3 or later.
Enable custom locations on your cluster
If you are signed in to Azure CLI as an Azure Active Directory (Azure AD) user, to enable this feature on your cluster, execute the following command:
az connectedk8s enable-features -n <clusterName> -g <resourceGroupName> --features cluster-connect custom-locations
If you run the above command while signed in to Azure CLI using a service principal, you may observe the following warning:
Unable to fetch oid of 'custom-locations' app. Proceeding without enabling the feature. Insufficient privileges to complete the operation.
This is because a service principal doesn't have permissions to get information about the application used by the Azure Arc service. To avoid this error, complete the following steps:
Sign in to Azure CLI using your user account. Fetch the
objectIdoridof the Azure AD application used by Azure Arc service. The command you use depends on your version of Azure CLI.If you're using an Azure CLI version lower than 2.37.0, use the following command:
az ad sp show --id bc313c14-388c-4e7d-a58e-70017303ee3b --query objectId -o tsvIf you're using Azure CLI version 2.37.0 or higher, use the following command instead:
az ad sp show --id bc313c14-388c-4e7d-a58e-70017303ee3b --query id -o tsvSign in to Azure CLI using the service principal. Use the
<objectId>oridvalue from the previous step to enable custom locations on the cluster:az connectedk8s enable-features -n <cluster-name> -g <resource-group-name> --custom-locations-oid <objectId/id> --features cluster-connect custom-locations
Note
The custom locations feature is dependent on the Cluster Connect feature. Both features have to be enabled for custom locations to work.
az connectedk8s enable-features must be run on a machine where the kubeconfig file is pointing to the cluster on which the features are to be enabled.
Create custom location
Deploy the Azure service cluster extension of the Azure service instance you want to install on your cluster:
Azure Arc-enabled Data Services
Note
Outbound proxy without authentication and outbound proxy with basic authentication are supported by the Azure Arc-enabled Data Services cluster extension. Outbound proxy that expects trusted certificates is currently not supported.
Get the Azure Resource Manager identifier of the Azure Arc-enabled Kubernetes cluster, referenced in later steps as
connectedClusterId:az connectedk8s show -n <clusterName> -g <resourceGroupName> --query id -o tsvGet the Azure Resource Manager identifier of the cluster extension deployed on top of Azure Arc-enabled Kubernetes cluster, referenced in later steps as
extensionId:az k8s-extension show --name <extensionInstanceName> --cluster-type connectedClusters -c <clusterName> -g <resourceGroupName> --query id -o tsvCreate the custom location by referencing the Azure Arc-enabled Kubernetes cluster and the extension:
az customlocation create -n <customLocationName> -g <resourceGroupName> --namespace <name of namespace> --host-resource-id <connectedClusterId> --cluster-extension-ids <extensionIds>Required parameters:
Parameter name Description --name, --nName of the custom location --resource-group, --gResource group of the custom location --namespaceNamespace in the cluster bound to the custom location being created --host-resource-idAzure Resource Manager identifier of the Azure Arc-enabled Kubernetes cluster (connected cluster) --cluster-extension-idsAzure Resource Manager identifiers of the cluster extension instances installed on the connected cluster. Provide a space-separated list of the cluster extension IDs Optional parameters:
Parameter name Description --location, --lLocation of the custom location Azure Resource Manager resource in Azure. By default it will be set to the location of the connected cluster --tagsSpace-separated list of tags: key[=value] [key[=value] ...]. Use '' to clear existing tags --kubeconfigAdmin kubeconfigof cluster
Show details of a custom location
To show the details of a custom location, use the following command:
az customlocation show -n <customLocationName> -g <resourceGroupName>
Required parameters:
| Parameter name | Description |
|---|---|
--name, --n |
Name of the custom location |
--resource-group, --g |
Resource group of the custom location |
List custom locations
To list all custom locations in a resource group, use the following command:
az customlocation show -g <resourceGroupName>
Required parameters:
| Parameter name | Description |
|---|---|
--resource-group, --g |
Resource group of the custom location |
Update a custom location
Use the update command to add new tags or associate new cluster extension IDs to the custom location while retaining existing tags and associated cluster extensions. --cluster-extension-ids, --tags, assign-identity can be updated.
az customlocation update -n <customLocationName> -g <resourceGroupName> --namespace <name of namespace> --host-resource-id <connectedClusterId> --cluster-extension-ids <extensionIds>
Required parameters:
| Parameter name | Description |
|---|---|
--name, --n |
Name of the custom location |
--resource-group, --g |
Resource group of the custom location |
--namespace |
Namespace in the cluster bound to the custom location being created |
--host-resource-id |
Azure Resource Manager identifier of the Azure Arc-enabled Kubernetes cluster (connected cluster) |
Optional parameters:
| Parameter name | Description |
|---|---|
--cluster-extension-ids |
Associate new cluster extensions to this custom location by providing Azure Resource Manager identifiers of the cluster extension instances installed on the connected cluster. Provide a space-separated list of the cluster extension IDs |
--tags |
Add new tags in addition to existing tags. Space-separated list of tags: key[=value] [key[=value] ...]. |
Patch a custom location
Use the patch command to replace existing tags, cluster extension IDs with new tags, and cluster extension IDs. --cluster-extension-ids, assign-identity, --tags can be patched.
az customlocation patch -n <customLocationName> -g <resourceGroupName> --namespace <name of namespace> --host-resource-id <connectedClusterId> --cluster-extension-ids <extensionIds>
Required parameters:
| Parameter name | Description |
|---|---|
--name, --n |
Name of the custom location |
--resource-group, --g |
Resource group of the custom location |
Optional parameters:
| Parameter name | Description |
|---|---|
--cluster-extension-ids |
Associate new cluster extensions to this custom location by providing Azure Resource Manager identifiers of the cluster extension instances installed on the connected cluster. Provide a space-separated list of the cluster extension IDs |
--tags |
Add new tags in addition to existing tags. Space-separated list of tags: key[=value] [key[=value] ...]. |
Delete a custom location
To delete a custom location, use the following command:
az customlocation delete -n <customLocationName> -g <resourceGroupName> --namespace <name of namespace> --host-resource-id <connectedClusterId> --cluster-extension-ids <extensionIds>
Next steps
- Securely connect to the cluster using Cluster Connect.
- Continue with Azure App Service on Azure Arc for end-to-end instructions on installing extensions, creating custom locations, and creating the App Service Kubernetes environment.
- Create an Event Grid topic and an event subscription for Event Grid on Kubernetes.
- Learn more about currently available Azure Arc-enabled Kubernetes extensions.
Feedback
Submit and view feedback for