Register a new Kubernetes cluster with Azure Resource Manager.
API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}?api-version=2024-12-01-preview
URI Parameters
Name |
In |
Required |
Type |
Description |
clusterName
|
path |
True
|
string
|
The name of the Kubernetes cluster on which get is called.
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
The name of the resource group. The name is case insensitive.
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
The ID of the target subscription.
|
api-version
|
query |
True
|
string
minLength: 1
|
The API version to use for this operation.
|
Request Body
Name |
Required |
Type |
Description |
identity
|
True
|
ConnectedClusterIdentity
|
The identity of the connected cluster.
|
location
|
True
|
string
|
The geo-location where the resource lives
|
properties.agentPublicKeyCertificate
|
True
|
string
|
Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure.
|
kind
|
|
ConnectedClusterKind
|
The kind of connected cluster.
|
properties.aadProfile
|
|
AadProfile
|
AAD profile for the connected cluster.
|
properties.arcAgentProfile
|
|
ArcAgentProfile
|
Arc agentry configuration for the provisioned cluster.
|
properties.arcAgentryConfigurations
|
|
ArcAgentryConfigurations[]
|
Configuration settings for customizing the behavior of the connected cluster.
|
properties.azureHybridBenefit
|
|
AzureHybridBenefit
|
Indicates whether Azure Hybrid Benefit is opted in
|
properties.distribution
|
|
string
|
The Kubernetes distribution running on this connected cluster.
|
properties.distributionVersion
|
|
string
|
The Kubernetes distribution version on this connected cluster.
|
properties.gateway
|
|
Gateway
|
Details of the gateway used by the Arc router for connectivity.
|
properties.infrastructure
|
|
string
|
The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on.
|
properties.oidcIssuerProfile
|
|
OidcIssuerProfile
|
Open ID Connect (OIDC) Issuer Profile for the connected cluster.
|
properties.privateLinkScopeResourceId
|
|
string
|
This is populated only if privateLinkState is enabled. The resource id of the private link scope this connected cluster is assigned to, if any.
|
properties.privateLinkState
|
|
PrivateLinkState
|
Property which describes the state of private link on a connected cluster resource.
|
properties.provisioningState
|
|
ProvisioningState
|
Provisioning state of the connected cluster resource.
|
properties.securityProfile
|
|
SecurityProfile
|
Security profile for the connected cluster.
|
tags
|
|
object
|
Resource tags.
|
Responses
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
CreateCluster_KindExample
Sample request
PUT https://management.azure.com/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourcegroups/k8sc-rg/providers/Microsoft.Kubernetes/connectedClusters/testCluster?api-version=2024-12-01-preview
{
"location": "East US",
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"kind": "ProvisionedCluster",
"properties": {
"agentPublicKeyCertificate": "",
"azureHybridBenefit": "NotApplicable",
"distribution": "AKS",
"distributionVersion": "1.0",
"aadProfile": {
"enableAzureRBAC": true,
"adminGroupObjectIDs": [
"56f988bf-86f1-41af-91ab-2d7cd011db47"
],
"tenantID": "82f988bf-86f1-41af-91ab-2d7cd011db47"
},
"oidcIssuerProfile": {
"enabled": true
},
"arcAgentProfile": {
"desiredAgentVersion": "0.1.0",
"agentAutoUpgrade": "Enabled",
"systemComponents": [
{
"type": "Strato",
"userSpecifiedVersion": "0.1.1",
"majorVersion": 0
}
]
}
}
}
import com.azure.resourcemanager.hybridkubernetes.models.AadProfile;
import com.azure.resourcemanager.hybridkubernetes.models.ArcAgentProfile;
import com.azure.resourcemanager.hybridkubernetes.models.AutoUpgradeOptions;
import com.azure.resourcemanager.hybridkubernetes.models.AzureHybridBenefit;
import com.azure.resourcemanager.hybridkubernetes.models.ConnectedClusterIdentity;
import com.azure.resourcemanager.hybridkubernetes.models.ConnectedClusterKind;
import com.azure.resourcemanager.hybridkubernetes.models.OidcIssuerProfile;
import com.azure.resourcemanager.hybridkubernetes.models.ResourceIdentityType;
import com.azure.resourcemanager.hybridkubernetes.models.SystemComponent;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ConnectedCluster CreateOrReplace.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/
* CreateCluster_KindExample.json
*/
/**
* Sample code: CreateCluster_KindExample.
*
* @param manager Entry point to HybridKubernetesManager.
*/
public static void
createClusterKindExample(com.azure.resourcemanager.hybridkubernetes.HybridKubernetesManager manager) {
manager.connectedClusters().define("testCluster").withRegion("East US").withExistingResourceGroup("k8sc-rg")
.withIdentity(new ConnectedClusterIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withAgentPublicKeyCertificate("").withTags(mapOf()).withKind(ConnectedClusterKind.PROVISIONED_CLUSTER)
.withDistribution("AKS").withDistributionVersion("1.0")
.withAzureHybridBenefit(AzureHybridBenefit.NOT_APPLICABLE)
.withAadProfile(new AadProfile().withEnableAzureRbac(true)
.withAdminGroupObjectIDs(Arrays.asList("56f988bf-86f1-41af-91ab-2d7cd011db47"))
.withTenantId("82f988bf-86f1-41af-91ab-2d7cd011db47"))
.withArcAgentProfile(new ArcAgentProfile().withDesiredAgentVersion("0.1.0")
.withAgentAutoUpgrade(AutoUpgradeOptions.ENABLED)
.withSystemComponents(Arrays.asList(
new SystemComponent().withType("Strato").withUserSpecifiedVersion("0.1.1").withMajorVersion(0))))
.withOidcIssuerProfile(new OidcIssuerProfile().withEnabled(true)).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhybridkubernetes_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridkubernetes/armhybridkubernetes/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ecee919199a39cc0d864410f540aa105bf7cdb64/specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/CreateCluster_KindExample.json
func ExampleConnectedClusterClient_BeginCreateOrReplace_createClusterKindExample() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhybridkubernetes.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewConnectedClusterClient().BeginCreateOrReplace(ctx, "k8sc-rg", "testCluster", armhybridkubernetes.ConnectedCluster{
Location: to.Ptr("East US"),
Tags: map[string]*string{},
Identity: &armhybridkubernetes.ConnectedClusterIdentity{
Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeSystemAssigned),
},
Kind: to.Ptr(armhybridkubernetes.ConnectedClusterKindProvisionedCluster),
Properties: &armhybridkubernetes.ConnectedClusterProperties{
AADProfile: &armhybridkubernetes.AADProfile{
AdminGroupObjectIDs: []*string{
to.Ptr("56f988bf-86f1-41af-91ab-2d7cd011db47")},
EnableAzureRBAC: to.Ptr(true),
TenantID: to.Ptr("82f988bf-86f1-41af-91ab-2d7cd011db47"),
},
AgentPublicKeyCertificate: to.Ptr(""),
ArcAgentProfile: &armhybridkubernetes.ArcAgentProfile{
AgentAutoUpgrade: to.Ptr(armhybridkubernetes.AutoUpgradeOptionsEnabled),
DesiredAgentVersion: to.Ptr("0.1.0"),
SystemComponents: []*armhybridkubernetes.SystemComponent{
{
Type: to.Ptr("Strato"),
MajorVersion: to.Ptr[int32](0),
UserSpecifiedVersion: to.Ptr("0.1.1"),
}},
},
AzureHybridBenefit: to.Ptr(armhybridkubernetes.AzureHybridBenefitNotApplicable),
Distribution: to.Ptr("AKS"),
DistributionVersion: to.Ptr("1.0"),
OidcIssuerProfile: &armhybridkubernetes.OidcIssuerProfile{
Enabled: to.Ptr(true),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ConnectedCluster = armhybridkubernetes.ConnectedCluster{
// Name: to.Ptr("connectedCluster1"),
// Type: to.Ptr("Microsoft.Kubernetes/connectedClusters"),
// ID: to.Ptr("/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1"),
// Location: to.Ptr("East US"),
// Tags: map[string]*string{
// },
// Identity: &armhybridkubernetes.ConnectedClusterIdentity{
// Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeSystemAssigned),
// },
// Kind: to.Ptr(armhybridkubernetes.ConnectedClusterKindProvisionedCluster),
// Properties: &armhybridkubernetes.ConnectedClusterProperties{
// AADProfile: &armhybridkubernetes.AADProfile{
// AdminGroupObjectIDs: []*string{
// to.Ptr("56f988bf-86f1-41af-91ab-2d7cd011db47")},
// EnableAzureRBAC: to.Ptr(true),
// TenantID: to.Ptr("82f988bf-86f1-41af-91ab-2d7cd011db47"),
// },
// AgentPublicKeyCertificate: to.Ptr(""),
// AgentVersion: to.Ptr("0.1.0"),
// ArcAgentProfile: &armhybridkubernetes.ArcAgentProfile{
// AgentAutoUpgrade: to.Ptr(armhybridkubernetes.AutoUpgradeOptionsEnabled),
// AgentState: to.Ptr("Succeeded"),
// DesiredAgentVersion: to.Ptr("0.1.0"),
// SystemComponents: []*armhybridkubernetes.SystemComponent{
// {
// Type: to.Ptr("Strato"),
// CurrentVersion: to.Ptr("0.1.0"),
// MajorVersion: to.Ptr[int32](0),
// UserSpecifiedVersion: to.Ptr("0.1.1"),
// }},
// },
// AzureHybridBenefit: to.Ptr(armhybridkubernetes.AzureHybridBenefitNotApplicable),
// Distribution: to.Ptr("AKS"),
// DistributionVersion: to.Ptr("1.0"),
// KubernetesVersion: to.Ptr("1.17.0"),
// OidcIssuerProfile: &armhybridkubernetes.OidcIssuerProfile{
// Enabled: to.Ptr(true),
// IssuerURL: to.Ptr("https://oidcdiscovery-northamerica-endpoint-gbcge4adgqebgxev.z01.azurefd.net/885hc665-0g4a-4a4b-732b-e4950new3bed/"),
// },
// ProvisioningState: to.Ptr(armhybridkubernetes.ProvisioningStateSucceeded),
// TotalNodeCount: to.Ptr[int32](2),
// },
// SystemData: &armhybridkubernetes.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// CreatedBy: to.Ptr("sikasire@microsoft.com"),
// CreatedByType: to.Ptr(armhybridkubernetes.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// LastModifiedBy: to.Ptr("sikasire@microsoft.com"),
// LastModifiedByType: to.Ptr(armhybridkubernetes.LastModifiedByTypeUser),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ConnectedKubernetesClient } = require("@azure/arm-hybridkubernetes");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
*
* @summary API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
* x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/CreateCluster_KindExample.json
*/
async function createClusterKindExample() {
const subscriptionId =
process.env["HYBRIDKUBERNETES_SUBSCRIPTION_ID"] || "1bfbb5d0-917e-4346-9026-1d3b344417f5";
const resourceGroupName = process.env["HYBRIDKUBERNETES_RESOURCE_GROUP"] || "k8sc-rg";
const clusterName = "testCluster";
const connectedCluster = {
identity: { type: "SystemAssigned" },
kind: "ProvisionedCluster",
location: "East US",
properties: {
aadProfile: {
adminGroupObjectIDs: ["56f988bf-86f1-41af-91ab-2d7cd011db47"],
enableAzureRbac: true,
tenantID: "82f988bf-86f1-41af-91ab-2d7cd011db47",
},
agentPublicKeyCertificate: "",
arcAgentProfile: {
agentAutoUpgrade: "Enabled",
desiredAgentVersion: "0.1.0",
systemComponents: [{ type: "Strato", majorVersion: 0, userSpecifiedVersion: "0.1.1" }],
},
azureHybridBenefit: "NotApplicable",
distribution: "AKS",
distributionVersion: "1.0",
oidcIssuerProfile: { enabled: true },
},
tags: {},
};
const credential = new DefaultAzureCredential();
const client = new ConnectedKubernetesClient(credential, subscriptionId);
const result = await client.connectedClusterOperations.beginCreateOrReplaceAndWait(
resourceGroupName,
clusterName,
connectedCluster,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "SystemAssigned"
},
"kind": "ProvisionedCluster",
"properties": {
"agentPublicKeyCertificate": "",
"kubernetesVersion": "1.17.0",
"totalNodeCount": 2,
"agentVersion": "0.1.0",
"provisioningState": "Succeeded",
"distribution": "AKS",
"distributionVersion": "1.0",
"azureHybridBenefit": "NotApplicable",
"aadProfile": {
"enableAzureRBAC": true,
"adminGroupObjectIDs": [
"56f988bf-86f1-41af-91ab-2d7cd011db47"
],
"tenantID": "82f988bf-86f1-41af-91ab-2d7cd011db47"
},
"oidcIssuerProfile": {
"enabled": true,
"issuerUrl": "https://oidcdiscovery-northamerica-endpoint-gbcge4adgqebgxev.z01.azurefd.net/885hc665-0g4a-4a4b-732b-e4950new3bed/"
},
"arcAgentProfile": {
"desiredAgentVersion": "0.1.0",
"agentAutoUpgrade": "Enabled",
"agentState": "Succeeded",
"systemComponents": [
{
"type": "Strato",
"userSpecifiedVersion": "0.1.1",
"currentVersion": "0.1.0",
"majorVersion": 0
}
]
}
}
}
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "",
"kubernetesVersion": "1.17.0",
"totalNodeCount": 2,
"agentVersion": "0.1.0",
"provisioningState": "Accepted",
"distribution": "AKS",
"distributionVersion": "1.0",
"azureHybridBenefit": "NotApplicable",
"aadProfile": {
"enableAzureRBAC": true,
"adminGroupObjectIDs": [
"56f988bf-86f1-41af-91ab-2d7cd011db47"
],
"tenantID": "82f988bf-86f1-41af-91ab-2d7cd011db47"
},
"oidcIssuerProfile": {
"enabled": true,
"issuerUrl": "https://oidcdiscovery-northamerica-endpoint-gbcge4adgqebgxev.z01.azurefd.net/885hc665-0g4a-4a4b-732b-e4950new3bed/"
},
"arcAgentProfile": {
"desiredAgentVersion": "0.1.0",
"agentAutoUpgrade": "Enabled",
"agentState": "Succeeded",
"systemComponents": [
{
"type": "Strato",
"userSpecifiedVersion": "0.1.1",
"currentVersion": "0.1.0",
"majorVersion": 0
}
]
}
}
}
CreateClusterAgentless_KindAWSExample
Sample request
PUT https://management.azure.com/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourcegroups/k8sc-rg/providers/Microsoft.Kubernetes/connectedClusters/testCluster?api-version=2024-12-01-preview
{
"location": "East US",
"tags": {},
"identity": {
"type": "None"
},
"kind": "AWS",
"properties": {
"agentPublicKeyCertificate": "",
"distribution": "eks",
"infrastructure": "aws"
}
}
import com.azure.resourcemanager.hybridkubernetes.models.ConnectedClusterIdentity;
import com.azure.resourcemanager.hybridkubernetes.models.ConnectedClusterKind;
import com.azure.resourcemanager.hybridkubernetes.models.ResourceIdentityType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ConnectedCluster CreateOrReplace.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/
* CreateClusterAgentless_KindAWSExample.json
*/
/**
* Sample code: CreateClusterAgentless_KindAWSExample.
*
* @param manager Entry point to HybridKubernetesManager.
*/
public static void createClusterAgentlessKindAWSExample(
com.azure.resourcemanager.hybridkubernetes.HybridKubernetesManager manager) {
manager.connectedClusters().define("testCluster").withRegion("East US").withExistingResourceGroup("k8sc-rg")
.withIdentity(new ConnectedClusterIdentity().withType(ResourceIdentityType.NONE))
.withAgentPublicKeyCertificate("").withTags(mapOf()).withKind(ConnectedClusterKind.AWS)
.withDistribution("eks").withInfrastructure("aws").create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhybridkubernetes_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridkubernetes/armhybridkubernetes/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ecee919199a39cc0d864410f540aa105bf7cdb64/specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/CreateClusterAgentless_KindAWSExample.json
func ExampleConnectedClusterClient_BeginCreateOrReplace_createClusterAgentlessKindAwsExample() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhybridkubernetes.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewConnectedClusterClient().BeginCreateOrReplace(ctx, "k8sc-rg", "testCluster", armhybridkubernetes.ConnectedCluster{
Location: to.Ptr("East US"),
Tags: map[string]*string{},
Identity: &armhybridkubernetes.ConnectedClusterIdentity{
Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeNone),
},
Kind: to.Ptr(armhybridkubernetes.ConnectedClusterKindAWS),
Properties: &armhybridkubernetes.ConnectedClusterProperties{
AgentPublicKeyCertificate: to.Ptr(""),
Distribution: to.Ptr("eks"),
Infrastructure: to.Ptr("aws"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ConnectedCluster = armhybridkubernetes.ConnectedCluster{
// Name: to.Ptr("connectedCluster1"),
// Type: to.Ptr("Microsoft.Kubernetes/connectedClusters"),
// ID: to.Ptr("/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1"),
// Location: to.Ptr("East US"),
// Tags: map[string]*string{
// },
// Identity: &armhybridkubernetes.ConnectedClusterIdentity{
// Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeNone),
// },
// Kind: to.Ptr(armhybridkubernetes.ConnectedClusterKindAWS),
// Properties: &armhybridkubernetes.ConnectedClusterProperties{
// AADProfile: &armhybridkubernetes.AADProfile{
// },
// AgentPublicKeyCertificate: to.Ptr(""),
// ArcAgentProfile: &armhybridkubernetes.ArcAgentProfile{
// },
// AzureHybridBenefit: to.Ptr(armhybridkubernetes.AzureHybridBenefitNotApplicable),
// ConnectivityStatus: to.Ptr(armhybridkubernetes.ConnectivityStatusAgentNotInstalled),
// Distribution: to.Ptr("eks"),
// Infrastructure: to.Ptr("aws"),
// PrivateLinkState: to.Ptr(armhybridkubernetes.PrivateLinkStateDisabled),
// ProvisioningState: to.Ptr(armhybridkubernetes.ProvisioningStateSucceeded),
// },
// SystemData: &armhybridkubernetes.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// CreatedBy: to.Ptr("sikasire@microsoft.com"),
// CreatedByType: to.Ptr(armhybridkubernetes.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// LastModifiedBy: to.Ptr("sikasire@microsoft.com"),
// LastModifiedByType: to.Ptr(armhybridkubernetes.LastModifiedByTypeUser),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ConnectedKubernetesClient } = require("@azure/arm-hybridkubernetes");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
*
* @summary API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
* x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/CreateClusterAgentless_KindAWSExample.json
*/
async function createClusterAgentlessKindAwsExample() {
const subscriptionId =
process.env["HYBRIDKUBERNETES_SUBSCRIPTION_ID"] || "1bfbb5d0-917e-4346-9026-1d3b344417f5";
const resourceGroupName = process.env["HYBRIDKUBERNETES_RESOURCE_GROUP"] || "k8sc-rg";
const clusterName = "testCluster";
const connectedCluster = {
identity: { type: "None" },
kind: "AWS",
location: "East US",
properties: {
agentPublicKeyCertificate: "",
distribution: "eks",
infrastructure: "aws",
},
tags: {},
};
const credential = new DefaultAzureCredential();
const client = new ConnectedKubernetesClient(credential, subscriptionId);
const result = await client.connectedClusterOperations.beginCreateOrReplaceAndWait(
resourceGroupName,
clusterName,
connectedCluster,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "None"
},
"kind": "AWS",
"properties": {
"provisioningState": "Succeeded",
"connectivityStatus": "AgentNotInstalled",
"privateLinkState": "Disabled",
"azureHybridBenefit": "NotApplicable",
"agentPublicKeyCertificate": "",
"aadProfile": {},
"distribution": "eks",
"infrastructure": "aws",
"arcAgentProfile": {}
}
}
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "None"
},
"properties": {
"provisioningState": "Succeeded",
"connectivityStatus": "AgentNotInstalled",
"privateLinkState": "Disabled",
"azureHybridBenefit": "NotApplicable",
"agentPublicKeyCertificate": "",
"aadProfile": {},
"distribution": "eks",
"infrastructure": "aws",
"arcAgentProfile": {}
}
}
CreateClusterExample
Sample request
PUT https://management.azure.com/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourcegroups/k8sc-rg/providers/Microsoft.Kubernetes/connectedClusters/testCluster?api-version=2024-12-01-preview
{
"location": "East US",
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
"azureHybridBenefit": "NotApplicable",
"distribution": "AKS",
"distributionVersion": "1.0"
}
}
import com.azure.resourcemanager.hybridkubernetes.models.AzureHybridBenefit;
import com.azure.resourcemanager.hybridkubernetes.models.ConnectedClusterIdentity;
import com.azure.resourcemanager.hybridkubernetes.models.ResourceIdentityType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ConnectedCluster CreateOrReplace.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/
* CreateClusterExample.json
*/
/**
* Sample code: CreateClusterExample.
*
* @param manager Entry point to HybridKubernetesManager.
*/
public static void
createClusterExample(com.azure.resourcemanager.hybridkubernetes.HybridKubernetesManager manager) {
manager.connectedClusters().define("testCluster").withRegion("East US").withExistingResourceGroup("k8sc-rg")
.withIdentity(new ConnectedClusterIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withAgentPublicKeyCertificate(
"MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO")
.withTags(mapOf()).withDistribution("AKS").withDistributionVersion("1.0")
.withAzureHybridBenefit(AzureHybridBenefit.NOT_APPLICABLE).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhybridkubernetes_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridkubernetes/armhybridkubernetes/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ecee919199a39cc0d864410f540aa105bf7cdb64/specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/CreateClusterExample.json
func ExampleConnectedClusterClient_BeginCreateOrReplace_createClusterExample() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhybridkubernetes.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewConnectedClusterClient().BeginCreateOrReplace(ctx, "k8sc-rg", "testCluster", armhybridkubernetes.ConnectedCluster{
Location: to.Ptr("East US"),
Tags: map[string]*string{},
Identity: &armhybridkubernetes.ConnectedClusterIdentity{
Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeSystemAssigned),
},
Properties: &armhybridkubernetes.ConnectedClusterProperties{
AgentPublicKeyCertificate: to.Ptr("MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO"),
AzureHybridBenefit: to.Ptr(armhybridkubernetes.AzureHybridBenefitNotApplicable),
Distribution: to.Ptr("AKS"),
DistributionVersion: to.Ptr("1.0"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ConnectedCluster = armhybridkubernetes.ConnectedCluster{
// Name: to.Ptr("connectedCluster1"),
// Type: to.Ptr("Microsoft.Kubernetes/connectedClusters"),
// ID: to.Ptr("/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1"),
// Location: to.Ptr("East US"),
// Tags: map[string]*string{
// },
// Identity: &armhybridkubernetes.ConnectedClusterIdentity{
// Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeSystemAssigned),
// },
// Properties: &armhybridkubernetes.ConnectedClusterProperties{
// AgentPublicKeyCertificate: to.Ptr("MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO"),
// AgentVersion: to.Ptr("0.1.0"),
// AzureHybridBenefit: to.Ptr(armhybridkubernetes.AzureHybridBenefitNotApplicable),
// Distribution: to.Ptr("AKS"),
// DistributionVersion: to.Ptr("1.0"),
// KubernetesVersion: to.Ptr("1.17.0"),
// ProvisioningState: to.Ptr(armhybridkubernetes.ProvisioningStateSucceeded),
// TotalNodeCount: to.Ptr[int32](2),
// },
// SystemData: &armhybridkubernetes.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// CreatedBy: to.Ptr("sikasire@microsoft.com"),
// CreatedByType: to.Ptr(armhybridkubernetes.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// LastModifiedBy: to.Ptr("sikasire@microsoft.com"),
// LastModifiedByType: to.Ptr(armhybridkubernetes.LastModifiedByTypeUser),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ConnectedKubernetesClient } = require("@azure/arm-hybridkubernetes");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
*
* @summary API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
* x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/CreateClusterExample.json
*/
async function createClusterExample() {
const subscriptionId =
process.env["HYBRIDKUBERNETES_SUBSCRIPTION_ID"] || "1bfbb5d0-917e-4346-9026-1d3b344417f5";
const resourceGroupName = process.env["HYBRIDKUBERNETES_RESOURCE_GROUP"] || "k8sc-rg";
const clusterName = "testCluster";
const connectedCluster = {
identity: { type: "SystemAssigned" },
location: "East US",
properties: {
agentPublicKeyCertificate:
"MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
azureHybridBenefit: "NotApplicable",
distribution: "AKS",
distributionVersion: "1.0",
},
tags: {},
};
const credential = new DefaultAzureCredential();
const client = new ConnectedKubernetesClient(credential, subscriptionId);
const result = await client.connectedClusterOperations.beginCreateOrReplaceAndWait(
resourceGroupName,
clusterName,
connectedCluster,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
"kubernetesVersion": "1.17.0",
"totalNodeCount": 2,
"agentVersion": "0.1.0",
"provisioningState": "Succeeded",
"distribution": "AKS",
"distributionVersion": "1.0",
"azureHybridBenefit": "NotApplicable"
}
}
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
"kubernetesVersion": "1.17.0",
"totalNodeCount": 2,
"agentVersion": "0.1.0",
"provisioningState": "Accepted",
"distribution": "AKS",
"distributionVersion": "1.0",
"azureHybridBenefit": "NotApplicable"
}
}
CreateClusterPrivateLinkExample
Sample request
PUT https://management.azure.com/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourcegroups/k8sc-rg/providers/Microsoft.Kubernetes/connectedClusters/testCluster?api-version=2024-12-01-preview
{
"location": "East US",
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
"privateLinkState": "Enabled",
"privateLinkScopeResourceId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName",
"azureHybridBenefit": "NotApplicable",
"distribution": "AKS",
"distributionVersion": "1.0"
}
}
import com.azure.resourcemanager.hybridkubernetes.models.AzureHybridBenefit;
import com.azure.resourcemanager.hybridkubernetes.models.ConnectedClusterIdentity;
import com.azure.resourcemanager.hybridkubernetes.models.PrivateLinkState;
import com.azure.resourcemanager.hybridkubernetes.models.ResourceIdentityType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ConnectedCluster CreateOrReplace.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/
* CreateClusterPrivateLinkExample.json
*/
/**
* Sample code: CreateClusterPrivateLinkExample.
*
* @param manager Entry point to HybridKubernetesManager.
*/
public static void
createClusterPrivateLinkExample(com.azure.resourcemanager.hybridkubernetes.HybridKubernetesManager manager) {
manager.connectedClusters().define("testCluster").withRegion("East US").withExistingResourceGroup("k8sc-rg")
.withIdentity(new ConnectedClusterIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withAgentPublicKeyCertificate(
"MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO")
.withTags(mapOf()).withDistribution("AKS").withDistributionVersion("1.0")
.withPrivateLinkState(PrivateLinkState.ENABLED)
.withPrivateLinkScopeResourceId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName")
.withAzureHybridBenefit(AzureHybridBenefit.NOT_APPLICABLE).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhybridkubernetes_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridkubernetes/armhybridkubernetes/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ecee919199a39cc0d864410f540aa105bf7cdb64/specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/CreateClusterPrivateLinkExample.json
func ExampleConnectedClusterClient_BeginCreateOrReplace_createClusterPrivateLinkExample() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhybridkubernetes.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewConnectedClusterClient().BeginCreateOrReplace(ctx, "k8sc-rg", "testCluster", armhybridkubernetes.ConnectedCluster{
Location: to.Ptr("East US"),
Tags: map[string]*string{},
Identity: &armhybridkubernetes.ConnectedClusterIdentity{
Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeSystemAssigned),
},
Properties: &armhybridkubernetes.ConnectedClusterProperties{
AgentPublicKeyCertificate: to.Ptr("MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO"),
AzureHybridBenefit: to.Ptr(armhybridkubernetes.AzureHybridBenefitNotApplicable),
Distribution: to.Ptr("AKS"),
DistributionVersion: to.Ptr("1.0"),
PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"),
PrivateLinkState: to.Ptr(armhybridkubernetes.PrivateLinkStateEnabled),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ConnectedCluster = armhybridkubernetes.ConnectedCluster{
// Name: to.Ptr("connectedCluster1"),
// Type: to.Ptr("Microsoft.Kubernetes/connectedClusters"),
// ID: to.Ptr("/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1"),
// Location: to.Ptr("East US"),
// Tags: map[string]*string{
// },
// Identity: &armhybridkubernetes.ConnectedClusterIdentity{
// Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeSystemAssigned),
// },
// Properties: &armhybridkubernetes.ConnectedClusterProperties{
// AgentPublicKeyCertificate: to.Ptr("MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO"),
// AgentVersion: to.Ptr("0.1.0"),
// AzureHybridBenefit: to.Ptr(armhybridkubernetes.AzureHybridBenefitNotApplicable),
// Distribution: to.Ptr("AKS"),
// DistributionVersion: to.Ptr("1.0"),
// KubernetesVersion: to.Ptr("1.17.0"),
// PrivateLinkScopeResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName"),
// PrivateLinkState: to.Ptr(armhybridkubernetes.PrivateLinkStateEnabled),
// ProvisioningState: to.Ptr(armhybridkubernetes.ProvisioningStateSucceeded),
// TotalNodeCount: to.Ptr[int32](2),
// },
// SystemData: &armhybridkubernetes.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// CreatedBy: to.Ptr("sikasire@microsoft.com"),
// CreatedByType: to.Ptr(armhybridkubernetes.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// LastModifiedBy: to.Ptr("sikasire@microsoft.com"),
// LastModifiedByType: to.Ptr(armhybridkubernetes.LastModifiedByTypeUser),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ConnectedKubernetesClient } = require("@azure/arm-hybridkubernetes");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
*
* @summary API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
* x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/CreateClusterPrivateLinkExample.json
*/
async function createClusterPrivateLinkExample() {
const subscriptionId =
process.env["HYBRIDKUBERNETES_SUBSCRIPTION_ID"] || "1bfbb5d0-917e-4346-9026-1d3b344417f5";
const resourceGroupName = process.env["HYBRIDKUBERNETES_RESOURCE_GROUP"] || "k8sc-rg";
const clusterName = "testCluster";
const connectedCluster = {
identity: { type: "SystemAssigned" },
location: "East US",
properties: {
agentPublicKeyCertificate:
"MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
azureHybridBenefit: "NotApplicable",
distribution: "AKS",
distributionVersion: "1.0",
privateLinkScopeResourceId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName",
privateLinkState: "Enabled",
},
tags: {},
};
const credential = new DefaultAzureCredential();
const client = new ConnectedKubernetesClient(credential, subscriptionId);
const result = await client.connectedClusterOperations.beginCreateOrReplaceAndWait(
resourceGroupName,
clusterName,
connectedCluster,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
"kubernetesVersion": "1.17.0",
"totalNodeCount": 2,
"agentVersion": "0.1.0",
"privateLinkState": "Enabled",
"privateLinkScopeResourceId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName",
"provisioningState": "Succeeded",
"azureHybridBenefit": "NotApplicable",
"distribution": "AKS",
"distributionVersion": "1.0"
}
}
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
"kubernetesVersion": "1.17.0",
"totalNodeCount": 2,
"agentVersion": "0.1.0",
"privateLinkState": "Enabled",
"privateLinkScopeResourceId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName",
"provisioningState": "Accepted",
"azureHybridBenefit": "NotApplicable",
"distribution": "AKS",
"distributionVersion": "1.0"
}
}
UpdateClusterByPutExample
Sample request
PUT https://management.azure.com/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourcegroups/k8sc-rg/providers/Microsoft.Kubernetes/connectedClusters/testCluster?api-version=2024-12-01-preview
{
"location": "East US",
"tags": {},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
"azureHybridBenefit": "NotApplicable",
"distribution": "AKS",
"distributionVersion": "1.0",
"gateway": {
"enabled": true,
"resourceId": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.HybridCompute/gateways/gateway1"
}
}
}
import com.azure.resourcemanager.hybridkubernetes.models.AzureHybridBenefit;
import com.azure.resourcemanager.hybridkubernetes.models.ConnectedClusterIdentity;
import com.azure.resourcemanager.hybridkubernetes.models.Gateway;
import com.azure.resourcemanager.hybridkubernetes.models.ResourceIdentityType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ConnectedCluster CreateOrReplace.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/
* UpdateClusterByPutExample.json
*/
/**
* Sample code: UpdateClusterByPutExample.
*
* @param manager Entry point to HybridKubernetesManager.
*/
public static void
updateClusterByPutExample(com.azure.resourcemanager.hybridkubernetes.HybridKubernetesManager manager) {
manager.connectedClusters().define("testCluster").withRegion("East US").withExistingResourceGroup("k8sc-rg")
.withIdentity(new ConnectedClusterIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withAgentPublicKeyCertificate(
"MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO")
.withTags(mapOf()).withDistribution("AKS").withDistributionVersion("1.0")
.withAzureHybridBenefit(AzureHybridBenefit.NOT_APPLICABLE)
.withGateway(new Gateway().withEnabled(true).withResourceId(
"/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.HybridCompute/gateways/gateway1"))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhybridkubernetes_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridkubernetes/armhybridkubernetes/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ecee919199a39cc0d864410f540aa105bf7cdb64/specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/UpdateClusterByPutExample.json
func ExampleConnectedClusterClient_BeginCreateOrReplace_updateClusterByPutExample() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhybridkubernetes.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewConnectedClusterClient().BeginCreateOrReplace(ctx, "k8sc-rg", "testCluster", armhybridkubernetes.ConnectedCluster{
Location: to.Ptr("East US"),
Tags: map[string]*string{},
Identity: &armhybridkubernetes.ConnectedClusterIdentity{
Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeSystemAssigned),
},
Properties: &armhybridkubernetes.ConnectedClusterProperties{
AgentPublicKeyCertificate: to.Ptr("MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO"),
AzureHybridBenefit: to.Ptr(armhybridkubernetes.AzureHybridBenefitNotApplicable),
Distribution: to.Ptr("AKS"),
DistributionVersion: to.Ptr("1.0"),
Gateway: &armhybridkubernetes.Gateway{
Enabled: to.Ptr(true),
ResourceID: to.Ptr("/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.HybridCompute/gateways/gateway1"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ConnectedCluster = armhybridkubernetes.ConnectedCluster{
// Name: to.Ptr("connectedCluster1"),
// Type: to.Ptr("Microsoft.Kubernetes/connectedClusters"),
// ID: to.Ptr("/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1"),
// Location: to.Ptr("East US"),
// Tags: map[string]*string{
// },
// Identity: &armhybridkubernetes.ConnectedClusterIdentity{
// Type: to.Ptr(armhybridkubernetes.ResourceIdentityTypeSystemAssigned),
// },
// Properties: &armhybridkubernetes.ConnectedClusterProperties{
// AgentPublicKeyCertificate: to.Ptr("MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO"),
// AgentVersion: to.Ptr("0.1.0"),
// AzureHybridBenefit: to.Ptr(armhybridkubernetes.AzureHybridBenefitNotApplicable),
// Distribution: to.Ptr("AKS"),
// DistributionVersion: to.Ptr("1.0"),
// Gateway: &armhybridkubernetes.Gateway{
// Enabled: to.Ptr(true),
// ResourceID: to.Ptr("/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.HybridCompute/gateways/gateway1"),
// },
// KubernetesVersion: to.Ptr("1.17.0"),
// ProvisioningState: to.Ptr(armhybridkubernetes.ProvisioningStateSucceeded),
// TotalNodeCount: to.Ptr[int32](2),
// },
// SystemData: &armhybridkubernetes.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// CreatedBy: to.Ptr("sikasire@microsoft.com"),
// CreatedByType: to.Ptr(armhybridkubernetes.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-17T07:06:33.917Z"); return t}()),
// LastModifiedBy: to.Ptr("sikasire@microsoft.com"),
// LastModifiedByType: to.Ptr(armhybridkubernetes.LastModifiedByTypeUser),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ConnectedKubernetesClient } = require("@azure/arm-hybridkubernetes");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
*
* @summary API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM).
* x-ms-original-file: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2024-12-01-preview/examples/UpdateClusterByPutExample.json
*/
async function updateClusterByPutExample() {
const subscriptionId =
process.env["HYBRIDKUBERNETES_SUBSCRIPTION_ID"] || "1bfbb5d0-917e-4346-9026-1d3b344417f5";
const resourceGroupName = process.env["HYBRIDKUBERNETES_RESOURCE_GROUP"] || "k8sc-rg";
const clusterName = "testCluster";
const connectedCluster = {
identity: { type: "SystemAssigned" },
location: "East US",
properties: {
agentPublicKeyCertificate:
"MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
azureHybridBenefit: "NotApplicable",
distribution: "AKS",
distributionVersion: "1.0",
gateway: {
enabled: true,
resourceId:
"/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.HybridCompute/gateways/gateway1",
},
},
tags: {},
};
const credential = new DefaultAzureCredential();
const client = new ConnectedKubernetesClient(credential, subscriptionId);
const result = await client.connectedClusterOperations.beginCreateOrReplaceAndWait(
resourceGroupName,
clusterName,
connectedCluster,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
"kubernetesVersion": "1.17.0",
"totalNodeCount": 2,
"agentVersion": "0.1.0",
"provisioningState": "Succeeded",
"distribution": "AKS",
"distributionVersion": "1.0",
"azureHybridBenefit": "NotApplicable",
"gateway": {
"enabled": true,
"resourceId": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.HybridCompute/gateways/gateway1"
}
}
}
{
"id": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.Kubernetes/connectedClusters/connectedCluster1",
"name": "connectedCluster1",
"type": "Microsoft.Kubernetes/connectedClusters",
"location": "East US",
"tags": {},
"systemData": {
"createdBy": "sikasire@microsoft.com",
"createdByType": "User",
"createdAt": "2020-12-17T07:06:33.9173186Z",
"lastModifiedBy": "sikasire@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-12-17T07:06:33.9173186Z"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"agentPublicKeyCertificate": "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO",
"kubernetesVersion": "1.17.0",
"totalNodeCount": 2,
"agentVersion": "0.1.0",
"provisioningState": "Accepted",
"distribution": "AKS",
"distributionVersion": "1.0",
"azureHybridBenefit": "NotApplicable",
"gateway": {
"enabled": true,
"resourceId": "/subscriptions/1bfbb5d0-917e-4346-9026-1d3b344417f5/resourceGroups/akkeshar/providers/Microsoft.HybridCompute/gateways/gateway1"
}
}
}
Definitions
AadProfile
Object
AAD Profile specifies attributes for Azure Active Directory integration.
Name |
Type |
Description |
adminGroupObjectIDs
|
string[]
|
The list of AAD group object IDs that will have admin role of the cluster.
|
enableAzureRBAC
|
boolean
|
Whether to enable Azure RBAC for Kubernetes authorization.
|
tenantID
|
string
|
The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription.
|
AgentError
Object
Agent Errors if any during agent or system component upgrade.
Name |
Type |
Description |
component
|
string
|
Agent component where error message occured.
|
message
|
string
|
Agent error message.
|
severity
|
string
|
Severity of the error message.
|
time
|
string
(date-time)
|
The timestamp of error occured (UTC).
|
ArcAgentProfile
Object
Defines the Arc Agent properties for the clusters.
Name |
Type |
Default value |
Description |
agentAutoUpgrade
|
AutoUpgradeOptions
|
Enabled
|
Indicates whether the Arc agents on the be upgraded automatically to the latest version. Defaults to Enabled.
|
agentErrors
|
AgentError[]
|
|
List of arc agentry and system components errors on the cluster resource.
|
agentState
|
string
|
|
Represents the current state of the Arc agentry and its dependent components.
|
desiredAgentVersion
|
string
|
|
Version of the Arc agents to be installed on the cluster resource
|
systemComponents
|
SystemComponent[]
|
|
List of system extensions that are installed on the cluster resource.
|
ArcAgentryConfigurations
Object
Name |
Type |
Description |
feature
|
string
|
Specifies the name of the feature for the configuration setting.
|
protectedSettings
|
object
|
The configuration settings for the feature that contain any sensitive or secret information.
|
settings
|
object
|
The configuration settings for the feature that do not contain any sensitive or secret information.
|
AutoUpgradeOptions
Enumeration
Indicates whether the Arc agents on the be upgraded automatically to the latest version. Defaults to Enabled.
Value |
Description |
Enabled
|
|
Disabled
|
|
AzureHybridBenefit
Enumeration
Indicates whether Azure Hybrid Benefit is opted in
Value |
Description |
True
|
|
False
|
|
NotApplicable
|
|
ConnectedCluster
Object
Represents a connected cluster.
Name |
Type |
Default value |
Description |
id
|
string
|
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
ConnectedClusterIdentity
|
|
The identity of the connected cluster.
|
kind
|
ConnectedClusterKind
|
|
The kind of connected cluster.
|
location
|
string
|
|
The geo-location where the resource lives
|
name
|
string
|
|
The name of the resource
|
properties.aadProfile
|
AadProfile
|
|
AAD profile for the connected cluster.
|
properties.agentPublicKeyCertificate
|
string
|
|
Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure.
|
properties.agentVersion
|
string
|
|
Version of the agent running on the connected cluster resource
|
properties.arcAgentProfile
|
ArcAgentProfile
|
|
Arc agentry configuration for the provisioned cluster.
|
properties.arcAgentryConfigurations
|
ArcAgentryConfigurations[]
|
|
Configuration settings for customizing the behavior of the connected cluster.
|
properties.azureHybridBenefit
|
AzureHybridBenefit
|
NotApplicable
|
Indicates whether Azure Hybrid Benefit is opted in
|
properties.connectivityStatus
|
ConnectivityStatus
|
|
Represents the connectivity status of the connected cluster.
|
properties.distribution
|
string
|
|
The Kubernetes distribution running on this connected cluster.
|
properties.distributionVersion
|
string
|
|
The Kubernetes distribution version on this connected cluster.
|
properties.gateway
|
Gateway
|
|
Details of the gateway used by the Arc router for connectivity.
|
properties.infrastructure
|
string
|
|
The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on.
|
properties.kubernetesVersion
|
string
|
|
The Kubernetes version of the connected cluster resource
|
properties.lastConnectivityTime
|
string
(date-time)
|
|
Time representing the last instance when heart beat was received from the cluster
|
properties.managedIdentityCertificateExpirationTime
|
string
(date-time)
|
|
Expiration time of the managed identity certificate
|
properties.miscellaneousProperties
|
object
|
|
More properties related to the Connected Cluster
|
properties.offering
|
string
|
|
Connected cluster offering
|
properties.oidcIssuerProfile
|
OidcIssuerProfile
|
|
Open ID Connect (OIDC) Issuer Profile for the connected cluster.
|
properties.privateLinkScopeResourceId
|
string
|
|
This is populated only if privateLinkState is enabled. The resource id of the private link scope this connected cluster is assigned to, if any.
|
properties.privateLinkState
|
PrivateLinkState
|
Disabled
|
Property which describes the state of private link on a connected cluster resource.
|
properties.provisioningState
|
ProvisioningState
|
|
Provisioning state of the connected cluster resource.
|
properties.securityProfile
|
SecurityProfile
|
|
Security profile for the connected cluster.
|
properties.totalCoreCount
|
integer
(int32)
|
|
Number of CPU cores present in the connected cluster resource
|
properties.totalNodeCount
|
integer
|
|
Number of nodes present in the connected cluster resource
|
systemData
|
SystemData
|
|
Metadata pertaining to creation and last modification of the resource
|
tags
|
object
|
|
Resource tags.
|
type
|
string
|
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
ConnectedClusterIdentity
Object
Identity for the connected cluster.
Name |
Type |
Default value |
Description |
principalId
|
string
|
|
The principal id of connected cluster identity. This property will only be provided for a system assigned identity.
|
tenantId
|
string
|
|
The tenant id associated with the connected cluster. This property will only be provided for a system assigned identity.
|
type
|
ResourceIdentityType
|
SystemAssigned
|
The type of identity used for the connected cluster. The type 'SystemAssigned, includes a system created identity. The type 'None' means no identity is assigned to the connected cluster.
|
ConnectedClusterKind
Enumeration
Indicates the kind of Arc connected cluster based on host infrastructure.
Value |
Description |
ProvisionedCluster
|
|
AWS
|
|
ConnectivityStatus
Enumeration
Represents the connectivity status of the connected cluster.
Value |
Description |
Connecting
|
|
Connected
|
|
Offline
|
|
Expired
|
|
AgentNotInstalled
|
|
createdByType
Enumeration
The type of identity that created the resource.
Value |
Description |
User
|
|
Application
|
|
ManagedIdentity
|
|
Key
|
|
ErrorAdditionalInfo
Object
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
Object
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ErrorResponse
Object
Error response
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
Gateway
Object
Name |
Type |
Description |
enabled
|
boolean
|
Indicates whether the gateway for arc router connectivity is enabled.
|
resourceId
|
string
(arm-id)
|
The resource ID of the gateway used for the Arc router feature.
|
lastModifiedByType
Enumeration
The type of identity that last modified the resource.
Value |
Description |
User
|
|
Application
|
|
ManagedIdentity
|
|
Key
|
|
OidcIssuerProfile
Object
OIDC Issuer Profile specifies attributes for workload identity integration.
Name |
Type |
Description |
enabled
|
boolean
|
Whether to enable oidc issuer for workload identity integration.
|
issuerUrl
|
string
|
The issuer url for hybrid clusters connected to Arc used for the workload identity feature.
|
selfHostedIssuerUrl
|
string
|
The issuer url for public cloud clusters - AKS, EKS, GKE - used for the workload identity feature.
|
PrivateLinkState
Enumeration
Property which describes the state of private link on a connected cluster resource.
Value |
Description |
Enabled
|
|
Disabled
|
|
ProvisioningState
Enumeration
Provisioning state of the connected cluster resource.
Value |
Description |
Succeeded
|
|
Failed
|
|
Canceled
|
|
Provisioning
|
|
Updating
|
|
Deleting
|
|
Accepted
|
|
ResourceIdentityType
Enumeration
The type of identity used for the connected cluster. The type 'SystemAssigned, includes a system created identity. The type 'None' means no identity is assigned to the connected cluster.
Value |
Description |
None
|
|
SystemAssigned
|
|
SecurityProfile
Object
Security Profile specifies attributes for cluster security features.
Name |
Type |
Description |
workloadIdentity
|
WorkloadIdentity
|
The workload identity feature webhook.
|
SystemComponent
Object
System extensions and its current versions installed on the cluster resource.
Name |
Type |
Description |
currentVersion
|
string
|
Version of the system extension that is currently installed on the cluster resource.
|
majorVersion
|
integer
(int32)
|
Major Version of the system extension that is currently installed on the cluster resource.
|
type
|
string
|
Type of the system extension
|
userSpecifiedVersion
|
string
|
Version of the system extension to be installed on the cluster resource.
|
SystemData
Object
Metadata pertaining to creation and last modification of the resource.
Name |
Type |
Description |
createdAt
|
string
(date-time)
|
The timestamp of resource creation (UTC).
|
createdBy
|
string
|
The identity that created the resource.
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
lastModifiedAt
|
string
(date-time)
|
The timestamp of resource modification (UTC).
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
lastModifiedByType
|
lastModifiedByType
|
The type of identity that last modified the resource.
|
WorkloadIdentity
Object
The workload identity feature webhook.
Name |
Type |
Description |
enabled
|
boolean
|
Whether to enable or disable the workload identity Webhook
|