Gets the results of a command which has been run on the Managed Cluster.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}?api-version=2024-09-01
URI Parameters
Name |
In |
Required |
Type |
Description |
commandId
|
path |
True
|
string
|
Id of the command.
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group. The name is case insensitive.
|
resourceName
|
path |
True
|
string
|
The name of the managed cluster resource.
Regex pattern: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$
|
subscriptionId
|
path |
True
|
string
uuid
|
The ID of the target subscription. The value must be an UUID.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
Responses
Name |
Type |
Description |
200 OK
|
RunCommandResult
|
command finished
|
202 Accepted
|
|
Accepted
Headers
Location: string
|
Other Status Codes
|
CloudError
|
Error response describing why the operation failed. If the cluster doesn't exist, 404 (Not found) is returned.
|
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
commandFailedResult
Sample request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/commandResults/def7b3ea71bd4f7e9d226ddbc0f00ad9?api-version=2024-09-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python run_command_result_failed.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.get_command_result(
resource_group_name="rg1",
resource_name="clustername1",
command_id="def7b3ea71bd4f7e9d226ddbc0f00ad9",
)
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultFailed.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/RunCommandResultFailed.json
func ExampleManagedClustersClient_GetCommandResult_commandFailedResult() {
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().GetCommandResult(ctx, "rg1", "clustername1", "def7b3ea71bd4f7e9d226ddbc0f00ad9", 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.RunCommandResult = armcontainerservice.RunCommandResult{
// ID: to.Ptr("def7b3ea71bd4f7e9d226ddbc0f00ad9"),
// Properties: &armcontainerservice.CommandResultProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// Reason: to.Ptr("ImagePullBackoff"),
// },
// }
}
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 Gets the results of a command which has been run on the Managed Cluster.
*
* @summary Gets the results of a command which has been run on the Managed Cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultFailed.json
*/
async function commandFailedResult() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9";
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.managedClusters.getCommandResult(
resourceGroupName,
resourceName,
commandId,
);
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
location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/commandResults/0e9872e6629349dc865e27ee6f8bab2d?api-version=2024-09-01
{
"id": "def7b3ea71bd4f7e9d226ddbc0f00ad9",
"properties": {
"provisioningState": "failed",
"reason": "ImagePullBackoff"
}
}
commandSucceedResult
Sample request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/commandResults/def7b3ea71bd4f7e9d226ddbc0f00ad9?api-version=2024-09-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerservice import ContainerServiceClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerservice
# USAGE
python run_command_result_succeed.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.get_command_result(
resource_group_name="rg1",
resource_name="clustername1",
command_id="def7b3ea71bd4f7e9d226ddbc0f00ad9",
)
print(response)
# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultSucceed.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/RunCommandResultSucceed.json
func ExampleManagedClustersClient_GetCommandResult_commandSucceedResult() {
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().GetCommandResult(ctx, "rg1", "clustername1", "def7b3ea71bd4f7e9d226ddbc0f00ad9", 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.RunCommandResult = armcontainerservice.RunCommandResult{
// ID: to.Ptr("def7b3ea71bd4f7e9d226ddbc0f00ad9"),
// Properties: &armcontainerservice.CommandResultProperties{
// ExitCode: to.Ptr[int32](0),
// FinishedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-17T00:28:33.000Z"); return t}()),
// Logs: to.Ptr("namespace dummy created"),
// ProvisioningState: to.Ptr("Succeeded"),
// StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-17T00:28:20.000Z"); return t}()),
// },
// }
}
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 Gets the results of a command which has been run on the Managed Cluster.
*
* @summary Gets the results of a command which has been run on the Managed Cluster.
* x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2024-09-01/examples/RunCommandResultSucceed.json
*/
async function commandSucceedResult() {
const subscriptionId =
process.env["CONTAINERSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERSERVICE_RESOURCE_GROUP"] || "rg1";
const resourceName = "clustername1";
const commandId = "def7b3ea71bd4f7e9d226ddbc0f00ad9";
const credential = new DefaultAzureCredential();
const client = new ContainerServiceClient(credential, subscriptionId);
const result = await client.managedClusters.getCommandResult(
resourceGroupName,
resourceName,
commandId,
);
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
location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/commandResults/0e9872e6629349dc865e27ee6f8bab2d?api-version=2024-09-01
{
"id": "def7b3ea71bd4f7e9d226ddbc0f00ad9",
"properties": {
"provisioningState": "succeeded",
"exitCode": 0,
"startedAt": "2021-02-17T00:28:20Z",
"finishedAt": "2021-02-17T00:28:33Z",
"logs": "namespace dummy created"
}
}
Definitions
CloudError
An error response from the Container service.
CloudErrorBody
An error response from the Container service.
Name |
Type |
Description |
code
|
string
|
An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
|
details
|
CloudErrorBody[]
|
A list of additional details about the error.
|
message
|
string
|
A message describing the error, intended to be suitable for display in a user interface.
|
target
|
string
|
The target of the particular error. For example, the name of the property in error.
|
RunCommandResult
run command result.
Name |
Type |
Description |
id
|
string
|
The command id.
|
properties.exitCode
|
integer
|
The exit code of the command
|
properties.finishedAt
|
string
|
The time when the command finished.
|
properties.logs
|
string
|
The command output.
|
properties.provisioningState
|
string
|
provisioning State
|
properties.reason
|
string
|
An explanation of why provisioningState is set to failed (if so).
|
properties.startedAt
|
string
|
The time when the command started.
|