Stops a Managed Cluster
This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See stopping a cluster for more details about stopping a cluster.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop?api-version=2022-04-01
URI Parameters
Name
In
Required
Type
Description
resourceGroupName
path
True
string
The name of the resource group. The name is case insensitive.
POST https://management.azure.com/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/stop?api-version=2022-04-01
import com.azure.core.util.Context;
/** Samples for ManagedClusters Stop. */
public final class Main {
/*
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-04-01/examples/ManagedClustersStop.json
*/
/**
* Sample code: Stop Managed Cluster.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void stopManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.kubernetesClusters()
.manager()
.serviceClient()
.getManagedClusters()
.stop("rg1", "clustername1", Context.NONE);
}
}
Read this SDK documentation on how to add the SDK to your project and authenticate.
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"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-04-01/examples/ManagedClustersStop.json
func ExampleManagedClustersClient_BeginStop() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armcontainerservice.NewManagedClustersClient("subid1", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := client.BeginStop(ctx,
"rg1",
"clustername1",
nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
Read this SDK documentation on how to add the SDK to your project and authenticate.
const { ContainerServiceClient } = require("@azure/arm-containerservice");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster.
*
* @summary This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2022-04-01/examples/ManagedClustersStop.json
*/
async function stopManagedCluster() {
const subscriptionId = "subid1";
const resourceGroupName = "rg1";
const resourceName = "clustername1";
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.managedClusters.beginStopAndWait(resourceGroupName, resourceName);
console.log(result);
}
stopManagedCluster().catch(console.error);
Read this SDK documentation on how to add the SDK to your project and authenticate.