Starts all containers in a container group. Compute resources will be allocated and billing will start.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start?api-version=2023-05-01
URI Parameters
Name |
In |
Required |
Type |
Description |
containerGroupName
|
path |
True
|
string
|
The name of the container group.
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group.
|
subscriptionId
|
path |
True
|
string
|
Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
|
api-version
|
query |
True
|
string
|
Client API version
|
Responses
Name |
Type |
Description |
202 Accepted
|
|
Started - the container group is starting.
|
204 No Content
|
|
Started - the container group is already running or starting.
|
Other Status Codes
|
CloudError
|
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
ContainerStart
Sample Request
POST https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1/start?api-version=2023-05-01
/** Samples for ContainerGroups Start. */
public final class Main {
/*
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsStart.json
*/
/**
* Sample code: ContainerStart.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void containerStart(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.containerGroups()
.manager()
.serviceClient()
.getContainerGroups()
.start("demo", "demo1", 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.containerinstance import ContainerInstanceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-containerinstance
# USAGE
python container_groups_start.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 = ContainerInstanceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.container_groups.begin_start(
resource_group_name="demo",
container_group_name="demo1",
).result()
print(response)
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsStart.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 armcontainerinstance_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsStart.json
func ExampleContainerGroupsClient_BeginStart() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginStart(ctx, "demo", "demo1", 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)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerInstanceManagementClient } = require("@azure/arm-containerinstance");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Starts all containers in a container group. Compute resources will be allocated and billing will start.
*
* @summary Starts all containers in a container group. Compute resources will be allocated and billing will start.
* x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsStart.json
*/
async function containerStart() {
const subscriptionId = process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginStartAndWait(
resourceGroupName,
containerGroupName
);
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.ContainerInstance;
using Azure.ResourceManager.ContainerInstance.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsStart.json
// this example is just showing the usage of "ContainerGroups_Start" 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 ContainerGroupResource created on azure
// for more information of creating ContainerGroupResource, please refer to the document of ContainerGroupResource
string subscriptionId = "subid";
string resourceGroupName = "demo";
string containerGroupName = "demo1";
ResourceIdentifier containerGroupResourceId = ContainerGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerGroupName);
ContainerGroupResource containerGroup = client.GetContainerGroupResource(containerGroupResourceId);
// invoke the operation
await containerGroup.StartAsync(WaitUntil.Completed);
Console.WriteLine($"Succeeded");
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
azure-asyncoperation: https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/locations/location/operations/operationId?api-version=apiVersion
Definitions
Name |
Description |
CloudError
|
An error response from the Container Instance service.
|
CloudErrorBody
|
An error response from the Container Instance service.
|
CloudError
An error response from the Container Instance service.
Name |
Type |
Description |
error
|
CloudErrorBody
|
An error response from the Container Instance service.
|
CloudErrorBody
An error response from the Container Instance 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.
|