Lists the user credentials of the provisioned cluster (can only be used within private network)
POST https://management.azure.com/{connectedClusterResourceUri}/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig?api-version=2024-01-01
URI Parameters
Name |
In |
Required |
Type |
Description |
connectedClusterResourceUri
|
path |
True
|
string
|
The fully qualified Azure Resource Manager identifier of the connected cluster resource.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
Responses
Name |
Type |
Description |
200 OK
|
ListCredentialResponse
|
OK
|
202 Accepted
|
|
Accepted
Headers
Location: string
|
Other Status Codes
|
ErrorResponse
|
Error response describing why the operation failed.
|
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
ListClusterUserCredentials
Sample request
POST https://management.azure.com/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/listUserKubeconfig?api-version=2024-01-01
/**
* Samples for ProvisionedClusterInstances ListUserKubeconfig.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/hybridaks/resource-manager/Microsoft.HybridContainerService/stable/2024-01-01/examples/
* ProvisionedClusterInstanceListUserKubeconfig.json
*/
/**
* Sample code: ListClusterUserCredentials.
*
* @param manager Entry point to HybridContainerServiceManager.
*/
public static void listClusterUserCredentials(
com.azure.resourcemanager.hybridcontainerservice.HybridContainerServiceManager manager) {
manager.provisionedClusterInstances().listUserKubeconfig(
"subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster",
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hybridcontainerservice import HybridContainerServiceMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hybridcontainerservice
# USAGE
python provisioned_cluster_instance_list_user_kubeconfig.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HybridContainerServiceMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.provisioned_cluster_instances.begin_list_user_kubeconfig(
connected_cluster_resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster",
).result()
print(response)
# x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/stable/2024-01-01/examples/ProvisionedClusterInstanceListUserKubeconfig.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhybridcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridcontainerservice/armhybridcontainerservice"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/hybridaks/resource-manager/Microsoft.HybridContainerService/stable/2024-01-01/examples/ProvisionedClusterInstanceListUserKubeconfig.json
func ExampleProvisionedClusterInstancesClient_BeginListUserKubeconfig() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhybridcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewProvisionedClusterInstancesClient().BeginListUserKubeconfig(ctx, "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster", 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.ListCredentialResponse = armhybridcontainerservice.ListCredentialResponse{
// Name: to.Ptr("766ea16c-53c6-421e-9b7d-a8bea47285ed*36530D233A0F410A40772AE878D8E7A0B2223081048946AD3D40DE0268480FBE"),
// ID: to.Ptr("/providers/Microsoft.HybridContainerService/locations/EASTUS/operationStatuses/766ea16c-53c6-421e-9b7d-a8bea47285ed*36530D233A0F410A40772AE878D8E7A0B2223081048946AD3D40DE0268480FBE"),
// Properties: &armhybridcontainerservice.ListCredentialResponseProperties{
// Kubeconfigs: []*armhybridcontainerservice.CredentialResult{
// {
// Name: to.Ptr("credentialName1"),
// Value: []byte("Y3JlZGVudGlhbFZhbHVlMQ=="),
// }},
// },
// ResourceID: to.Ptr("/subscriptions/921d26b3-c14d-4efc-b56e-93a2439e028c/resourceGroups/rg/providers/Microsoft.HybridContainerService/provisionedClusters/cluster-pc-1-24"),
// Status: to.Ptr(armhybridcontainerservice.ResourceProvisioningStateSucceeded),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HybridContainerServiceClient } = require("@azure/arm-hybridcontainerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists the user credentials of the provisioned cluster (can only be used within private network)
*
* @summary Lists the user credentials of the provisioned cluster (can only be used within private network)
* x-ms-original-file: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/stable/2024-01-01/examples/ProvisionedClusterInstanceListUserKubeconfig.json
*/
async function listClusterUserCredentials() {
const connectedClusterResourceUri =
"subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster";
const credential = new DefaultAzureCredential();
const client = new HybridContainerServiceClient(credential);
const result = await client.provisionedClusterInstances.beginListUserKubeconfigAndWait(
connectedClusterResourceUri,
);
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
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HybridContainerService;
using Azure.ResourceManager.HybridContainerService.Models;
// Generated from example definition: specification/hybridaks/resource-manager/Microsoft.HybridContainerService/stable/2024-01-01/examples/ProvisionedClusterInstanceListUserKubeconfig.json
// this example is just showing the usage of "provisionedClusterInstances_ListUserKubeconfig" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ProvisionedClusterResource created on azure
// for more information of creating ProvisionedClusterResource, please refer to the document of ProvisionedClusterResource
string connectedClusterResourceUri = "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/test-hybridakscluster";
ResourceIdentifier provisionedClusterResourceId = ProvisionedClusterResource.CreateResourceIdentifier(connectedClusterResourceUri);
ProvisionedClusterResource provisionedCluster = client.GetProvisionedClusterResource(provisionedClusterResourceId);
// invoke the operation
ArmOperation<HybridContainerServiceCredentialListResult> lro = await provisionedCluster.GetUserKubeconfigAsync(WaitUntil.Completed);
HybridContainerServiceCredentialListResult result = lro.Value;
Console.WriteLine($"Succeeded: {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": "/providers/Microsoft.HybridContainerService/locations/EASTUS/operationStatuses/766ea16c-53c6-421e-9b7d-a8bea47285ed*36530D233A0F410A40772AE878D8E7A0B2223081048946AD3D40DE0268480FBE",
"name": "766ea16c-53c6-421e-9b7d-a8bea47285ed*36530D233A0F410A40772AE878D8E7A0B2223081048946AD3D40DE0268480FBE",
"resourceId": "/subscriptions/921d26b3-c14d-4efc-b56e-93a2439e028c/resourceGroups/rg/providers/Microsoft.HybridContainerService/provisionedClusters/cluster-pc-1-24",
"status": "Succeeded",
"properties": {
"kubeconfigs": [
{
"name": "credentialName1",
"value": "Y3JlZGVudGlhbFZhbHVlMQ=="
}
]
}
}
Azure-AsyncOperation: https://management.azure.com/providers/Microsoft.HybridContainerService/locations/westus/operations/00000000-0000-0000-0000-000000000000?api-version=2024-01-01
location: https://foo.com/operationStatuses
Definitions
CredentialResult
Object
The credential result response.
Name |
Type |
Description |
name
|
string
|
The name of the credential.
|
value
|
string
|
Base64-encoded Kubernetes configuration file.
|
Error
Object
Name |
Type |
Description |
code
|
string
|
|
message
|
string
|
|
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.
|
ListCredentialResponse
Object
The list kubeconfig result response.
Name |
Type |
Description |
error
|
Error
|
|
id
|
string
|
Operation Id
|
name
|
string
|
Operation Name
|
properties
|
Properties
|
|
resourceId
|
string
|
ARM Resource Id of the provisioned cluster instance
|
status
|
ResourceProvisioningState
|
Provisioning state of the resource
|
Properties
Object
Name |
Type |
Description |
kubeconfigs
|
CredentialResult[]
|
Base64-encoded Kubernetes configuration file.
|
ResourceProvisioningState
Enumeration
Provisioning state of the resource
Value |
Description |
Accepted
|
|
Canceled
|
|
Creating
|
|
Deleting
|
|
Failed
|
|
Pending
|
|
Succeeded
|
|
Updating
|
|
Upgrading
|
|