Enumera las credenciales de administrador de un clúster administrado.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential?api-version=2024-09-01
Con parámetros opcionales:
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential?api-version=2024-09-01&server-fqdn={server-fqdn}
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
resourceGroupName
|
path |
True
|
string
|
Nombre del grupo de recursos. El nombre no distingue mayúsculas de minúsculas.
|
resourceName
|
path |
True
|
string
|
Nombre del recurso de clúster administrado.
Patrón de Regex: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$
|
subscriptionId
|
path |
True
|
string
uuid
|
Identificador de la suscripción de destino. El valor debe ser un UUID.
|
api-version
|
query |
True
|
string
|
Versión de la API que se va a usar para esta operación.
|
server-fqdn
|
query |
|
string
|
tipo fqdn de servidor para que se devuelvan las credenciales
|
Respuestas
Nombre |
Tipo |
Description |
200 OK
|
CredentialResults
|
De acuerdo
|
Other Status Codes
|
CloudError
|
Respuesta de error que describe por qué se produjo un error en la operación.
|
Seguridad
azure_auth
Flujo de OAuth2 de Azure Active Directory
Tipo:
oauth2
Flujo:
implicit
Dirección URL de autorización:
https://login.microsoftonline.com/common/oauth2/authorize
Ámbitos
Nombre |
Description |
user_impersonation
|
suplantar la cuenta de usuario
|
Ejemplos
Get Managed Cluster
Solicitud de ejemplo
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/listClusterAdminCredential?api-version=2024-09-01
/**
* Samples for ManagedClusters ListClusterAdminCredentials.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/
* ManagedClustersListClusterAdminCredentials.json
*/
/**
* Sample code: Get Managed Cluster.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) {
azure.kubernetesClusters().manager().serviceClient().getManagedClusters()
.listClusterAdminCredentialsWithResponse("rg1", "clustername1", null, 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.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python managed_clusters_list_cluster_admin_credentials.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 = ContainerServiceClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.managed_clusters.list_cluster_admin_credentials(
resource_group_name="rg1",
resource_name="clustername1",
)
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/ManagedClustersListClusterAdminCredentials.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 armcontainerservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/ManagedClustersListClusterAdminCredentials.json
func ExampleManagedClustersClient_ListClusterAdminCredentials() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewManagedClustersClient().ListClusterAdminCredentials(ctx, "rg1", "clustername1", &armcontainerservice.ManagedClustersClientListClusterAdminCredentialsOptions{ServerFqdn: nil})
if err != nil {
log.Fatalf("failed to finish the request: %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.CredentialResults = armcontainerservice.CredentialResults{
// Kubeconfigs: []*armcontainerservice.CredentialResult{
// {
// Name: to.Ptr("credentialName1"),
// Value: []byte("Y3JlZGVudGlhbFZhbHVlMQ=="),
// }},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists the admin credentials of a managed cluster.
*
* @summary Lists the admin credentials of a managed cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/ManagedClustersListClusterAdminCredentials.json
*/
async function getManagedCluster() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.managedClusters.listClusterAdminCredentials(
resourceGroupName,
resourceName,
);
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
Respuesta de muestra
{
"kubeconfigs": [
{
"name": "credentialName1",
"value": "Y3JlZGVudGlhbFZhbHVlMQ=="
}
]
}
Definiciones
CloudError
Respuesta de error del servicio contenedor.
CloudErrorBody
Respuesta de error del servicio contenedor.
Nombre |
Tipo |
Description |
code
|
string
|
Identificador del error. Los códigos son invariables y están diseñados para consumirse mediante programación.
|
details
|
CloudErrorBody[]
|
Lista de detalles adicionales sobre el error.
|
message
|
string
|
Mensaje que describe el error, diseñado para ser adecuado para mostrarse en una interfaz de usuario.
|
target
|
string
|
Destino del error concreto. Por ejemplo, el nombre de la propiedad en error.
|
CredentialResult
Respuesta de resultado de credenciales.
Nombre |
Tipo |
Description |
name
|
string
|
Nombre de la credencial.
|
value
|
string
|
Archivo de configuración de Kubernetes codificado en Base64.
|
CredentialResults
Respuesta de resultado de credenciales de lista.
Nombre |
Tipo |
Description |
kubeconfigs
|
CredentialResult[]
|
Archivo de configuración de Kubernetes codificado en Base64.
|