指定した構成でコンテナー グループを作成または更新します。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}?api-version=2026-07-01
URI パラメーター
| Name |
/ |
必須 |
型 |
説明 |
|
containerGroupName
|
path |
True
|
string
|
コンテナー グループの名前。
|
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
リソース グループの名前。 名前は大文字と小文字を区別しません。
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
ターゲット サブスクリプションの ID。 値は UUID である必要があります。
|
|
api-version
|
query |
True
|
string
minLength: 1
|
この操作に使用する API バージョン。
|
要求本文
応答
| Name |
型 |
説明 |
|
200 OK
|
ContainerGroup
|
リソース「ContainerGroup」更新操作が成功しました
|
|
201 Created
|
ContainerGroup
|
リソース「ContainerGroup」作成操作が成功しました
ヘッダー
- Location: string
- Retry-After: integer
|
|
Other Status Codes
|
CloudError
|
予期しないエラー応答。
|
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー。
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
| Name |
説明 |
|
user_impersonation
|
あなたのユーザー アカウントになりすます
|
例
ConfidentialContainerGroup
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2026-07-01
{
"location": "westeurope",
"properties": {
"confidentialComputeProperties": {
"ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
},
"containers": [
{
"name": "accdemo",
"properties": {
"command": [],
"environmentVariables": [],
"image": "confiimage",
"ports": [
{
"port": 8000
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
},
"securityContext": {
"capabilities": {
"add": [
"CAP_NET_ADMIN"
]
},
"privileged": false
}
}
}
],
"imageRegistryCredentials": [],
"ipAddress": {
"type": "Public",
"ports": [
{
"port": 8000,
"protocol": "TCP"
}
]
},
"osType": "Linux",
"sku": "Confidential"
}
}
import com.azure.resourcemanager.containerinstance.fluent.models.ContainerGroupInner;
import com.azure.resourcemanager.containerinstance.models.ConfidentialComputeProperties;
import com.azure.resourcemanager.containerinstance.models.Container;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIpAddressType;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupNetworkProtocol;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupSku;
import com.azure.resourcemanager.containerinstance.models.ContainerPort;
import com.azure.resourcemanager.containerinstance.models.IpAddress;
import com.azure.resourcemanager.containerinstance.models.OperatingSystemTypes;
import com.azure.resourcemanager.containerinstance.models.Port;
import com.azure.resourcemanager.containerinstance.models.ResourceRequests;
import com.azure.resourcemanager.containerinstance.models.ResourceRequirements;
import com.azure.resourcemanager.containerinstance.models.SecurityContextCapabilitiesDefinition;
import com.azure.resourcemanager.containerinstance.models.SecurityContextDefinition;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ContainerGroups CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/ContainerGroupCreateConfidential.json
*/
/**
* Sample code: ConfidentialContainerGroup.
*
* @param manager Entry point to ContainerInstanceManager.
*/
public static void
confidentialContainerGroup(com.azure.resourcemanager.containerinstance.ContainerInstanceManager manager) {
manager.serviceClient().getContainerGroups().createOrUpdate("demo", "demo1", new ContainerGroupInner()
.withLocation("westeurope")
.withContainers(Arrays.asList(new Container().withName("accdemo").withImage("confiimage")
.withCommand(Arrays.asList()).withPorts(Arrays.asList(new ContainerPort().withPort(8000)))
.withEnvironmentVariables(Arrays.asList())
.withResources(
new ResourceRequirements().withRequests(new ResourceRequests().withMemoryInGB(1.5).withCpu(1.0)))
.withSecurityContext(new SecurityContextDefinition().withPrivileged(false).withCapabilities(
new SecurityContextCapabilitiesDefinition().withAdd(Arrays.asList("CAP_NET_ADMIN"))))))
.withImageRegistryCredentials(Arrays.asList())
.withIpAddress(new IpAddress()
.withPorts(Arrays.asList(new Port().withProtocol(ContainerGroupNetworkProtocol.TCP).withPort(8000)))
.withType(ContainerGroupIpAddressType.PUBLIC))
.withOsType(OperatingSystemTypes.LINUX).withSku(ContainerGroupSku.CONFIDENTIAL)
.withConfidentialComputeProperties(new ConfidentialComputeProperties().withCcePolicy(
"eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19")),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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_group_create_confidential.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="SUBSCRIPTION_ID",
)
response = client.container_groups.begin_create_or_update(
resource_group_name="demo",
container_group_name="demo1",
container_group={
"location": "westeurope",
"properties": {
"confidentialComputeProperties": {
"ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
},
"containers": [
{
"name": "accdemo",
"properties": {
"command": [],
"environmentVariables": [],
"image": "confiimage",
"ports": [{"port": 8000}],
"resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}},
"securityContext": {"capabilities": {"add": ["CAP_NET_ADMIN"]}, "privileged": False},
},
}
],
"imageRegistryCredentials": [],
"ipAddress": {"ports": [{"port": 8000, "protocol": "TCP"}], "type": "Public"},
"osType": "Linux",
"sku": "Confidential",
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/ContainerGroupCreateConfidential.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v3"
)
// Generated from example definition: 2026-07-01/ContainerGroupCreateConfidential.json
func ExampleContainerGroupsClient_BeginCreateOrUpdate_confidentialContainerGroup() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
Location: to.Ptr("westeurope"),
Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
ConfidentialComputeProperties: &armcontainerinstance.ConfidentialComputeProperties{
CcePolicy: to.Ptr("eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"),
},
Containers: []*armcontainerinstance.Container{
{
Name: to.Ptr("accdemo"),
Properties: &armcontainerinstance.ContainerProperties{
Command: []*string{},
EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{},
Image: to.Ptr("confiimage"),
Ports: []*armcontainerinstance.ContainerPort{
{
Port: to.Ptr[int32](8000),
},
},
Resources: &armcontainerinstance.ResourceRequirements{
Requests: &armcontainerinstance.ResourceRequests{
CPU: to.Ptr[float64](1),
MemoryInGB: to.Ptr[float64](1.5),
},
},
SecurityContext: &armcontainerinstance.SecurityContextDefinition{
Capabilities: &armcontainerinstance.SecurityContextCapabilitiesDefinition{
Add: []*string{
to.Ptr("CAP_NET_ADMIN"),
},
},
Privileged: to.Ptr(false),
},
},
},
},
ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{},
IPAddress: &armcontainerinstance.IPAddress{
Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
Ports: []*armcontainerinstance.Port{
{
Port: to.Ptr[int32](8000),
Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
},
},
},
OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUConfidential),
},
}, 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 poll 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 = armcontainerinstance.ContainerGroupsClientCreateOrUpdateResponse{
// ContainerGroup: armcontainerinstance.ContainerGroup{
// Name: to.Ptr("demo1"),
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
// Location: to.Ptr("westeurope"),
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
// ConfidentialComputeProperties: &armcontainerinstance.ConfidentialComputeProperties{
// CcePolicy: to.Ptr("eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"),
// },
// Containers: []*armcontainerinstance.Container{
// {
// Name: to.Ptr("accdemo"),
// Properties: &armcontainerinstance.ContainerProperties{
// Command: []*string{
// },
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
// },
// Image: to.Ptr("confiimage"),
// Ports: []*armcontainerinstance.ContainerPort{
// {
// Port: to.Ptr[int32](8000),
// },
// },
// Resources: &armcontainerinstance.ResourceRequirements{
// Requests: &armcontainerinstance.ResourceRequests{
// CPU: to.Ptr[float64](1),
// MemoryInGB: to.Ptr[float64](1.5),
// },
// },
// SecurityContext: &armcontainerinstance.SecurityContextDefinition{
// Capabilities: &armcontainerinstance.SecurityContextCapabilitiesDefinition{
// Add: []*string{
// to.Ptr("CAP_NET_ADMIN"),
// },
// },
// Privileged: to.Ptr(false),
// },
// },
// },
// },
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
// },
// InitContainers: []*armcontainerinstance.InitContainerDefinition{
// },
// InstanceView: &armcontainerinstance.ContainerGroupPropertiesInstanceView{
// Events: []*armcontainerinstance.Event{
// },
// State: to.Ptr("Running"),
// },
// IPAddress: &armcontainerinstance.IPAddress{
// Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
// Ports: []*armcontainerinstance.Port{
// {
// Port: to.Ptr[int32](8000),
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
// },
// },
// },
// IsCreatedFromStandbyPool: to.Ptr(false),
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUConfidential),
// },
// },
// }
}
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 create or update container groups with specified configurations.
*
* @summary create or update container groups with specified configurations.
* x-ms-original-file: 2026-07-01/ContainerGroupCreateConfidential.json
*/
async function confidentialContainerGroup() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.createOrUpdate("demo", "demo1", {
location: "westeurope",
confidentialComputeProperties: {
ccePolicy:
"eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19",
},
containers: [
{
name: "accdemo",
command: [],
environmentVariables: [],
image: "confiimage",
ports: [{ port: 8000 }],
resources: { requests: { cpu: 1, memoryInGB: 1.5 } },
securityContext: { capabilities: { add: ["CAP_NET_ADMIN"] }, privileged: false },
},
],
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 8000, protocol: "TCP" }] },
osType: "Linux",
sku: "Confidential",
});
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
応答のサンプル
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "westeurope",
"properties": {
"confidentialComputeProperties": {
"ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
},
"containers": [
{
"name": "accdemo",
"properties": {
"command": [],
"environmentVariables": [],
"image": "confiimage",
"ports": [
{
"port": 8000
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
},
"securityContext": {
"capabilities": {
"add": [
"CAP_NET_ADMIN"
]
},
"privileged": false
}
}
}
],
"imageRegistryCredentials": [],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Running"
},
"ipAddress": {
"type": "Public",
"ports": [
{
"port": 8000,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Succeeded",
"sku": "Confidential"
}
}
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "westeurope",
"properties": {
"confidentialComputeProperties": {
"ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
},
"containers": [
{
"name": "accdemo",
"properties": {
"command": [],
"environmentVariables": [],
"image": "confiimage",
"ports": [
{
"port": 8000
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
},
"securityContext": {
"capabilities": {
"add": [
"CAP_NET_ADMIN"
]
},
"privileged": false
}
}
}
],
"imageRegistryCredentials": [],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Running"
},
"ipAddress": {
"type": "Public",
"ports": [
{
"port": 8000,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Succeeded",
"sku": "Confidential"
}
}
ContainerGroupCreateOrUpdateWithStandbyPool
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2026-07-01
{
"location": "west us",
"properties": {
"containerGroupProfile": {
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp",
"revision": 1
},
"containers": [
{
"name": "demo1",
"properties": {
"configMap": {
"keyValuePairs": {
"Newkey": "value"
}
}
}
}
],
"standbyPoolProfile": {
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool"
}
}
}
import com.azure.resourcemanager.containerinstance.fluent.models.ContainerGroupInner;
import com.azure.resourcemanager.containerinstance.models.ConfigMap;
import com.azure.resourcemanager.containerinstance.models.Container;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupProfileReferenceDefinition;
import com.azure.resourcemanager.containerinstance.models.StandbyPoolProfileDefinition;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ContainerGroups CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/ContainerGroupCreateOrUpdateStandbyPool.json
*/
/**
* Sample code: ContainerGroupCreateOrUpdateWithStandbyPool.
*
* @param manager Entry point to ContainerInstanceManager.
*/
public static void containerGroupCreateOrUpdateWithStandbyPool(
com.azure.resourcemanager.containerinstance.ContainerInstanceManager manager) {
manager.serviceClient().getContainerGroups().createOrUpdate("demo", "demo1", new ContainerGroupInner()
.withLocation("west us")
.withContainers(Arrays.asList(new Container().withName("demo1")
.withConfigMap(new ConfigMap().withKeyValuePairs(mapOf("Newkey", "fakeTokenPlaceholder")))))
.withContainerGroupProfile(new ContainerGroupProfileReferenceDefinition().withId(
"/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp")
.withRevision(1))
.withStandbyPoolProfile(new StandbyPoolProfileDefinition().withId(
"/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool")),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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_group_create_or_update_standby_pool.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="SUBSCRIPTION_ID",
)
response = client.container_groups.begin_create_or_update(
resource_group_name="demo",
container_group_name="demo1",
container_group={
"location": "west us",
"properties": {
"containerGroupProfile": {
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp",
"revision": 1,
},
"containers": [{"name": "demo1", "properties": {"configMap": {"keyValuePairs": {"Newkey": "value"}}}}],
"standbyPoolProfile": {
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool"
},
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/ContainerGroupCreateOrUpdateStandbyPool.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v3"
)
// Generated from example definition: 2026-07-01/ContainerGroupCreateOrUpdateStandbyPool.json
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupCreateOrUpdateWithStandbyPool() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
Location: to.Ptr("west us"),
Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
ContainerGroupProfile: &armcontainerinstance.ContainerGroupProfileReferenceDefinition{
ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp"),
Revision: to.Ptr[int32](1),
},
Containers: []*armcontainerinstance.Container{
{
Name: to.Ptr("demo1"),
Properties: &armcontainerinstance.ContainerProperties{
ConfigMap: &armcontainerinstance.ConfigMap{
KeyValuePairs: map[string]*string{
"Newkey": to.Ptr("value"),
},
},
},
},
},
StandbyPoolProfile: &armcontainerinstance.StandbyPoolProfileDefinition{
ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool"),
},
},
}, 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 poll 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 = armcontainerinstance.ContainerGroupsClientCreateOrUpdateResponse{
// ContainerGroup: armcontainerinstance.ContainerGroup{
// Name: to.Ptr("demo1"),
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
// Location: to.Ptr("eastus2"),
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
// ContainerGroupProfile: &armcontainerinstance.ContainerGroupProfileReferenceDefinition{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp"),
// Revision: to.Ptr[int32](1),
// },
// Containers: []*armcontainerinstance.Container{
// {
// Name: to.Ptr("demo1"),
// Properties: &armcontainerinstance.ContainerProperties{
// Command: []*string{
// },
// ConfigMap: &armcontainerinstance.ConfigMap{
// KeyValuePairs: map[string]*string{
// "Newkey": to.Ptr("value"),
// },
// },
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
// },
// Image: to.Ptr("nginx"),
// Ports: []*armcontainerinstance.ContainerPort{
// {
// Port: to.Ptr[int32](80),
// },
// },
// Resources: &armcontainerinstance.ResourceRequirements{
// Requests: &armcontainerinstance.ResourceRequests{
// CPU: to.Ptr[float64](1),
// MemoryInGB: to.Ptr[float64](1.5),
// },
// },
// },
// },
// },
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
// },
// InitContainers: []*armcontainerinstance.InitContainerDefinition{
// },
// InstanceView: &armcontainerinstance.ContainerGroupPropertiesInstanceView{
// Events: []*armcontainerinstance.Event{
// },
// State: to.Ptr("Running"),
// },
// IsCreatedFromStandbyPool: to.Ptr(true),
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
// },
// },
// }
}
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 create or update container groups with specified configurations.
*
* @summary create or update container groups with specified configurations.
* x-ms-original-file: 2026-07-01/ContainerGroupCreateOrUpdateStandbyPool.json
*/
async function containerGroupCreateOrUpdateWithStandbyPool() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.createOrUpdate("demo", "demo1", {
location: "west us",
containerGroupProfile: {
id: "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp",
revision: 1,
},
containers: [{ name: "demo1", configMap: { keyValuePairs: { Newkey: "value" } } }],
standbyPoolProfile: {
id: "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool",
},
});
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
応答のサンプル
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "eastus2",
"properties": {
"containerGroupProfile": {
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp",
"revision": 1
},
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"configMap": {
"keyValuePairs": {
"Newkey": "value"
}
},
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"imageRegistryCredentials": [],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Running"
},
"isCreatedFromStandbyPool": true,
"osType": "Linux",
"provisioningState": "Succeeded",
"sku": "Standard"
}
}
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "eastus2",
"properties": {
"containerGroupProfile": {
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp",
"revision": 1
},
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"configMap": {
"keyValuePairs": {
"Newkey": "value"
}
},
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"imageRegistryCredentials": [],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Running"
},
"isCreatedFromStandbyPool": true,
"osType": "Linux",
"provisioningState": "Succeeded",
"sku": "Standard"
}
}
ContainerGroupCreateWithExtensions
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2026-07-01
{
"location": "eastus2",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"imageRegistryCredentials": [],
"ipAddress": {
"type": "Private",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"osType": "Linux",
"subnetIds": [
{
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
}
],
"extensions": [
{
"name": "kube-proxy",
"properties": {
"extensionType": "kube-proxy",
"protectedSettings": {
"kubeConfig": "<kubeconfig encoded string>"
},
"settings": {
"clusterCidr": "10.240.0.0/16",
"kubeVersion": "v1.9.10"
},
"version": "1.0"
}
},
{
"name": "vk-realtime-metrics",
"properties": {
"extensionType": "realtime-metrics",
"version": "1.0"
}
}
]
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.containerinstance.fluent.models.ContainerGroupInner;
import com.azure.resourcemanager.containerinstance.models.Container;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIpAddressType;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupNetworkProtocol;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupSubnetId;
import com.azure.resourcemanager.containerinstance.models.ContainerPort;
import com.azure.resourcemanager.containerinstance.models.DeploymentExtensionSpec;
import com.azure.resourcemanager.containerinstance.models.IpAddress;
import com.azure.resourcemanager.containerinstance.models.OperatingSystemTypes;
import com.azure.resourcemanager.containerinstance.models.Port;
import com.azure.resourcemanager.containerinstance.models.ResourceRequests;
import com.azure.resourcemanager.containerinstance.models.ResourceRequirements;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ContainerGroups CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/ContainerGroupExtensions.json
*/
/**
* Sample code: ContainerGroupCreateWithExtensions.
*
* @param manager Entry point to ContainerInstanceManager.
*/
public static void containerGroupCreateWithExtensions(
com.azure.resourcemanager.containerinstance.ContainerInstanceManager manager) throws IOException {
manager.serviceClient().getContainerGroups().createOrUpdate("demo", "demo1", new ContainerGroupInner()
.withLocation("eastus2")
.withContainers(Arrays.asList(new Container().withName("demo1").withImage("nginx")
.withCommand(Arrays.asList()).withPorts(Arrays.asList(new ContainerPort().withPort(80)))
.withEnvironmentVariables(Arrays.asList()).withResources(
new ResourceRequirements().withRequests(new ResourceRequests().withMemoryInGB(1.5).withCpu(1.0)))))
.withImageRegistryCredentials(Arrays.asList())
.withIpAddress(new IpAddress()
.withPorts(Arrays.asList(new Port().withProtocol(ContainerGroupNetworkProtocol.TCP).withPort(80)))
.withType(ContainerGroupIpAddressType.PRIVATE))
.withOsType(OperatingSystemTypes.LINUX)
.withSubnetIds(Arrays.asList(new ContainerGroupSubnetId().withId(
"/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet")))
.withExtensions(Arrays.asList(
new DeploymentExtensionSpec().withName("kube-proxy").withExtensionType("kube-proxy").withVersion("1.0")
.withSettings(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"clusterCidr\":\"10.240.0.0/16\",\"kubeVersion\":\"v1.9.10\"}", Object.class,
SerializerEncoding.JSON))
.withProtectedSettings(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"kubeConfig\":\"<kubeconfig encoded string>\"}", Object.class, SerializerEncoding.JSON)),
new DeploymentExtensionSpec().withName("vk-realtime-metrics").withExtensionType("realtime-metrics")
.withVersion("1.0"))),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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_group_extensions.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="SUBSCRIPTION_ID",
)
response = client.container_groups.begin_create_or_update(
resource_group_name="demo",
container_group_name="demo1",
container_group={
"location": "eastus2",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [{"port": 80}],
"resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}},
},
}
],
"extensions": [
{
"name": "kube-proxy",
"properties": {
"extensionType": "kube-proxy",
"protectedSettings": {"kubeConfig": "<kubeconfig encoded string>"},
"settings": {"clusterCidr": "10.240.0.0/16", "kubeVersion": "v1.9.10"},
"version": "1.0",
},
},
{
"name": "vk-realtime-metrics",
"properties": {"extensionType": "realtime-metrics", "version": "1.0"},
},
],
"imageRegistryCredentials": [],
"ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Private"},
"osType": "Linux",
"subnetIds": [
{
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
}
],
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/ContainerGroupExtensions.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v3"
)
// Generated from example definition: 2026-07-01/ContainerGroupExtensions.json
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupCreateWithExtensions() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
Location: to.Ptr("eastus2"),
Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
Containers: []*armcontainerinstance.Container{
{
Name: to.Ptr("demo1"),
Properties: &armcontainerinstance.ContainerProperties{
Command: []*string{},
EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{},
Image: to.Ptr("nginx"),
Ports: []*armcontainerinstance.ContainerPort{
{
Port: to.Ptr[int32](80),
},
},
Resources: &armcontainerinstance.ResourceRequirements{
Requests: &armcontainerinstance.ResourceRequests{
CPU: to.Ptr[float64](1),
MemoryInGB: to.Ptr[float64](1.5),
},
},
},
},
},
ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{},
IPAddress: &armcontainerinstance.IPAddress{
Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePrivate),
Ports: []*armcontainerinstance.Port{
{
Port: to.Ptr[int32](80),
Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
},
},
},
OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
SubnetIDs: []*armcontainerinstance.ContainerGroupSubnetID{
{
ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"),
},
},
Extensions: []*armcontainerinstance.DeploymentExtensionSpec{
{
Name: to.Ptr("kube-proxy"),
Properties: &armcontainerinstance.DeploymentExtensionSpecProperties{
ExtensionType: to.Ptr("kube-proxy"),
ProtectedSettings: map[string]any{
"kubeConfig": "<kubeconfig encoded string>",
},
Settings: map[string]any{
"clusterCidr": "10.240.0.0/16",
"kubeVersion": "v1.9.10",
},
Version: to.Ptr("1.0"),
},
},
{
Name: to.Ptr("vk-realtime-metrics"),
Properties: &armcontainerinstance.DeploymentExtensionSpecProperties{
ExtensionType: to.Ptr("realtime-metrics"),
Version: to.Ptr("1.0"),
},
},
},
},
}, 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 poll 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 = armcontainerinstance.ContainerGroupsClientCreateOrUpdateResponse{
// ContainerGroup: armcontainerinstance.ContainerGroup{
// Name: to.Ptr("demo1"),
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
// Location: to.Ptr("eastus2"),
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
// Containers: []*armcontainerinstance.Container{
// {
// Name: to.Ptr("demo1"),
// Properties: &armcontainerinstance.ContainerProperties{
// Command: []*string{
// },
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
// },
// Image: to.Ptr("nginx"),
// Ports: []*armcontainerinstance.ContainerPort{
// {
// Port: to.Ptr[int32](80),
// },
// },
// Resources: &armcontainerinstance.ResourceRequirements{
// Requests: &armcontainerinstance.ResourceRequests{
// CPU: to.Ptr[float64](1),
// MemoryInGB: to.Ptr[float64](1.5),
// },
// },
// },
// },
// },
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
// },
// InitContainers: []*armcontainerinstance.InitContainerDefinition{
// },
// InstanceView: &armcontainerinstance.ContainerGroupPropertiesInstanceView{
// Events: []*armcontainerinstance.Event{
// },
// State: to.Ptr("Pending"),
// },
// IsCreatedFromStandbyPool: to.Ptr(false),
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Pending"),
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
// SubnetIDs: []*armcontainerinstance.ContainerGroupSubnetID{
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"),
// },
// },
// Extensions: []*armcontainerinstance.DeploymentExtensionSpec{
// {
// Name: to.Ptr("kube-proxy"),
// Properties: &armcontainerinstance.DeploymentExtensionSpecProperties{
// ExtensionType: to.Ptr("kube-proxy"),
// Settings: map[string]any{
// "clusterCidr": "10.240.0.0/16",
// "kubeVersion": "v1.9.10",
// },
// Version: to.Ptr("1.0"),
// },
// },
// {
// Name: to.Ptr("vk-realtime-metrics"),
// Properties: &armcontainerinstance.DeploymentExtensionSpecProperties{
// ExtensionType: to.Ptr("realtime-metrics"),
// Version: to.Ptr("1.0"),
// },
// },
// },
// },
// },
// }
}
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 create or update container groups with specified configurations.
*
* @summary create or update container groups with specified configurations.
* x-ms-original-file: 2026-07-01/ContainerGroupExtensions.json
*/
async function containerGroupCreateWithExtensions() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.createOrUpdate("demo", "demo1", {
location: "eastus2",
containers: [
{
name: "demo1",
command: [],
environmentVariables: [],
image: "nginx",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, memoryInGB: 1.5 } },
},
],
imageRegistryCredentials: [],
ipAddress: { type: "Private", ports: [{ port: 80, protocol: "TCP" }] },
osType: "Linux",
subnetIds: [
{
id: "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet",
},
],
extensions: [
{
name: "kube-proxy",
extensionType: "kube-proxy",
protectedSettings: { kubeConfig: "<kubeconfig encoded string>" },
settings: { clusterCidr: "10.240.0.0/16", kubeVersion: "v1.9.10" },
version: "1.0",
},
{ name: "vk-realtime-metrics", extensionType: "realtime-metrics", version: "1.0" },
],
});
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
応答のサンプル
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "eastus2",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"imageRegistryCredentials": [],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Pending"
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Pending",
"sku": "Standard",
"subnetIds": [
{
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
}
],
"extensions": [
{
"name": "kube-proxy",
"properties": {
"extensionType": "kube-proxy",
"settings": {
"clusterCidr": "10.240.0.0/16",
"kubeVersion": "v1.9.10"
},
"version": "1.0"
}
},
{
"name": "vk-realtime-metrics",
"properties": {
"extensionType": "realtime-metrics",
"version": "1.0"
}
}
]
}
}
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "eastus2",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"imageRegistryCredentials": [],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Running"
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Pending",
"sku": "Standard",
"subnetIds": [
{
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
}
],
"extensions": [
{
"name": "kube-proxy",
"properties": {
"extensionType": "kube-proxy",
"settings": {
"clusterCidr": "10.240.0.0/16",
"kubeVersion": "v1.9.10"
},
"version": "1.0"
}
},
{
"name": "vk-realtime-metrics",
"properties": {
"extensionType": "realtime-metrics",
"version": "1.0"
}
}
]
}
}
ContainerGroupsCreateOrUpdate
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2026-07-01
{
"identity": {
"type": "SystemAssigned, UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}
}
},
"location": "west us",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"gpu": {
"count": 1,
"sku": "K80"
},
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"diagnostics": {
"logAnalytics": {
"logType": "ContainerInsights",
"metadata": {
"test-key": "test-metadata-value"
},
"workspaceId": "workspaceid",
"workspaceKey": "workspaceKey",
"workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"
}
},
"dnsConfig": {
"nameServers": [
"1.1.1.1"
],
"options": "ndots:2",
"searchDomains": "cluster.local svc.cluster.local"
},
"imageRegistryCredentials": [],
"ipAddress": {
"type": "Public",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"osType": "Linux",
"subnetIds": [
{
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
}
],
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountKey": "accountKey",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {
"secretKey1": "SecretValue1InBase64",
"secretKey2": "SecretValue2InBase64"
}
}
]
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.containerinstance.fluent.models.ContainerGroupInner;
import com.azure.resourcemanager.containerinstance.models.AzureFileVolume;
import com.azure.resourcemanager.containerinstance.models.Container;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupDiagnostics;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIdentity;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIdentityUserAssignedIdentities;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIpAddressType;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupNetworkProtocol;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupSubnetId;
import com.azure.resourcemanager.containerinstance.models.ContainerPort;
import com.azure.resourcemanager.containerinstance.models.DnsConfiguration;
import com.azure.resourcemanager.containerinstance.models.DnsNameLabelReusePolicy;
import com.azure.resourcemanager.containerinstance.models.GpuResource;
import com.azure.resourcemanager.containerinstance.models.GpuSku;
import com.azure.resourcemanager.containerinstance.models.IpAddress;
import com.azure.resourcemanager.containerinstance.models.LogAnalytics;
import com.azure.resourcemanager.containerinstance.models.LogAnalyticsLogType;
import com.azure.resourcemanager.containerinstance.models.OperatingSystemTypes;
import com.azure.resourcemanager.containerinstance.models.Port;
import com.azure.resourcemanager.containerinstance.models.ResourceIdentityType;
import com.azure.resourcemanager.containerinstance.models.ResourceRequests;
import com.azure.resourcemanager.containerinstance.models.ResourceRequirements;
import com.azure.resourcemanager.containerinstance.models.Volume;
import com.azure.resourcemanager.containerinstance.models.VolumeMount;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ContainerGroups CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/ContainerGroupsCreateOrUpdate.json
*/
/**
* Sample code: ContainerGroupsCreateOrUpdate.
*
* @param manager Entry point to ContainerInstanceManager.
*/
public static void containerGroupsCreateOrUpdate(
com.azure.resourcemanager.containerinstance.ContainerInstanceManager manager) throws IOException {
manager.serviceClient().getContainerGroups().createOrUpdate("demo", "demo1", new ContainerGroupInner()
.withLocation("west us")
.withIdentity(new ContainerGroupIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
new ContainerGroupIdentityUserAssignedIdentities())))
.withContainers(Arrays.asList(new Container().withName("demo1").withImage("nginx")
.withCommand(Arrays.asList()).withPorts(Arrays.asList(new ContainerPort().withPort(80)))
.withEnvironmentVariables(Arrays.asList())
.withResources(new ResourceRequirements().withRequests(new ResourceRequests().withMemoryInGB(1.5)
.withCpu(1.0).withGpu(new GpuResource().withCount(1).withSku(GpuSku.K80))))
.withVolumeMounts(Arrays.asList(
new VolumeMount().withName("volume1").withMountPath("/mnt/volume1").withReadOnly(false),
new VolumeMount().withName("volume2").withMountPath("/mnt/volume2").withReadOnly(false),
new VolumeMount().withName("volume3").withMountPath("/mnt/volume3").withReadOnly(true)))))
.withImageRegistryCredentials(Arrays.asList())
.withIpAddress(new IpAddress()
.withPorts(Arrays.asList(new Port().withProtocol(ContainerGroupNetworkProtocol.TCP).withPort(80)))
.withType(ContainerGroupIpAddressType.PUBLIC).withDnsNameLabel("dnsnamelabel1")
.withAutoGeneratedDomainNameLabelScope(DnsNameLabelReusePolicy.UNSECURE))
.withOsType(OperatingSystemTypes.LINUX)
.withVolumes(Arrays.asList(
new Volume().withName("volume1")
.withAzureFile(new AzureFileVolume().withShareName("shareName")
.withStorageAccountName("accountName").withStorageAccountKey("fakeTokenPlaceholder")),
new Volume().withName("volume2")
.withEmptyDir(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize("{}",
Object.class, SerializerEncoding.JSON)),
new Volume().withName("volume3")
.withSecret(mapOf("secretKey1", "fakeTokenPlaceholder", "secretKey2", "fakeTokenPlaceholder"))))
.withDiagnostics(new ContainerGroupDiagnostics().withLogAnalytics(new LogAnalytics()
.withWorkspaceId("workspaceid").withWorkspaceKey("fakeTokenPlaceholder")
.withLogType(LogAnalyticsLogType.CONTAINER_INSIGHTS)
.withMetadata(mapOf("test-key", "fakeTokenPlaceholder")).withWorkspaceResourceId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace")))
.withSubnetIds(Arrays.asList(new ContainerGroupSubnetId().withId(
"[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]")))
.withDnsConfig(new DnsConfiguration().withNameServers(Arrays.asList("1.1.1.1"))
.withSearchDomains("cluster.local svc.cluster.local").withOptions("ndots:2")),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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_create_or_update.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="SUBSCRIPTION_ID",
)
response = client.container_groups.begin_create_or_update(
resource_group_name="demo",
container_group_name="demo1",
container_group={
"identity": {
"type": "SystemAssigned, UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}
},
},
"location": "west us",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [{"port": 80}],
"resources": {"requests": {"cpu": 1, "gpu": {"count": 1, "sku": "K80"}, "memoryInGB": 1.5}},
"volumeMounts": [
{"mountPath": "/mnt/volume1", "name": "volume1", "readOnly": False},
{"mountPath": "/mnt/volume2", "name": "volume2", "readOnly": False},
{"mountPath": "/mnt/volume3", "name": "volume3", "readOnly": True},
],
},
}
],
"diagnostics": {
"logAnalytics": {
"logType": "ContainerInsights",
"metadata": {"test-key": "test-metadata-value"},
"workspaceId": "workspaceid",
"workspaceKey": "workspaceKey",
"workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
}
},
"dnsConfig": {
"nameServers": ["1.1.1.1"],
"options": "ndots:2",
"searchDomains": "cluster.local svc.cluster.local",
},
"imageRegistryCredentials": [],
"ipAddress": {
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"ports": [{"port": 80, "protocol": "TCP"}],
"type": "Public",
},
"osType": "Linux",
"subnetIds": [
{
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
}
],
"volumes": [
{
"azureFile": {
"shareName": "shareName",
"storageAccountKey": "accountKey",
"storageAccountName": "accountName",
},
"name": "volume1",
},
{"emptyDir": {}, "name": "volume2"},
{
"name": "volume3",
"secret": {"secretKey1": "SecretValue1InBase64", "secretKey2": "SecretValue2InBase64"},
},
],
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/ContainerGroupsCreateOrUpdate.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v3"
)
// Generated from example definition: 2026-07-01/ContainerGroupsCreateOrUpdate.json
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
Identity: &armcontainerinstance.ContainerGroupIdentity{
Type: to.Ptr(armcontainerinstance.ResourceIdentityTypeSystemAssignedUserAssigned),
UserAssignedIdentities: map[string]*armcontainerinstance.UserAssignedIdentities{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {},
},
},
Location: to.Ptr("west us"),
Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
Containers: []*armcontainerinstance.Container{
{
Name: to.Ptr("demo1"),
Properties: &armcontainerinstance.ContainerProperties{
Command: []*string{},
EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{},
Image: to.Ptr("nginx"),
Ports: []*armcontainerinstance.ContainerPort{
{
Port: to.Ptr[int32](80),
},
},
Resources: &armcontainerinstance.ResourceRequirements{
Requests: &armcontainerinstance.ResourceRequests{
CPU: to.Ptr[float64](1),
Gpu: &armcontainerinstance.GpuResource{
Count: to.Ptr[int32](1),
SKU: to.Ptr(armcontainerinstance.GpuSKUK80),
},
MemoryInGB: to.Ptr[float64](1.5),
},
},
VolumeMounts: []*armcontainerinstance.VolumeMount{
{
Name: to.Ptr("volume1"),
MountPath: to.Ptr("/mnt/volume1"),
ReadOnly: to.Ptr(false),
},
{
Name: to.Ptr("volume2"),
MountPath: to.Ptr("/mnt/volume2"),
ReadOnly: to.Ptr(false),
},
{
Name: to.Ptr("volume3"),
MountPath: to.Ptr("/mnt/volume3"),
ReadOnly: to.Ptr(true),
},
},
},
},
},
Diagnostics: &armcontainerinstance.ContainerGroupDiagnostics{
LogAnalytics: &armcontainerinstance.LogAnalytics{
LogType: to.Ptr(armcontainerinstance.LogAnalyticsLogTypeContainerInsights),
Metadata: map[string]*string{
"test-key": to.Ptr("test-metadata-value"),
},
WorkspaceID: to.Ptr("workspaceid"),
WorkspaceKey: to.Ptr("workspaceKey"),
WorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"),
},
},
DNSConfig: &armcontainerinstance.DNSConfiguration{
NameServers: []*string{
to.Ptr("1.1.1.1"),
},
Options: to.Ptr("ndots:2"),
SearchDomains: to.Ptr("cluster.local svc.cluster.local"),
},
ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{},
IPAddress: &armcontainerinstance.IPAddress{
Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
AutoGeneratedDomainNameLabelScope: to.Ptr(armcontainerinstance.DNSNameLabelReusePolicyUnsecure),
DNSNameLabel: to.Ptr("dnsnamelabel1"),
Ports: []*armcontainerinstance.Port{
{
Port: to.Ptr[int32](80),
Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
},
},
},
OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
SubnetIDs: []*armcontainerinstance.ContainerGroupSubnetID{
{
ID: to.Ptr("[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"),
},
},
Volumes: []*armcontainerinstance.Volume{
{
Name: to.Ptr("volume1"),
AzureFile: &armcontainerinstance.AzureFileVolume{
ShareName: to.Ptr("shareName"),
StorageAccountKey: to.Ptr("accountKey"),
StorageAccountName: to.Ptr("accountName"),
},
},
{
Name: to.Ptr("volume2"),
EmptyDir: map[string]any{},
},
{
Name: to.Ptr("volume3"),
Secret: map[string]*string{
"secretKey1": to.Ptr("SecretValue1InBase64"),
"secretKey2": to.Ptr("SecretValue2InBase64"),
},
},
},
},
}, 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 poll 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 = armcontainerinstance.ContainerGroupsClientCreateOrUpdateResponse{
// ContainerGroup: armcontainerinstance.ContainerGroup{
// Name: to.Ptr("demo1"),
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
// Location: to.Ptr("WestUs"),
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
// Containers: []*armcontainerinstance.Container{
// {
// Name: to.Ptr("demo1"),
// Properties: &armcontainerinstance.ContainerProperties{
// Command: []*string{
// },
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
// },
// Image: to.Ptr("nginx"),
// Ports: []*armcontainerinstance.ContainerPort{
// {
// Port: to.Ptr[int32](80),
// },
// },
// Resources: &armcontainerinstance.ResourceRequirements{
// Requests: &armcontainerinstance.ResourceRequests{
// CPU: to.Ptr[float64](1),
// Gpu: &armcontainerinstance.GpuResource{
// Count: to.Ptr[int32](1),
// SKU: to.Ptr(armcontainerinstance.GpuSKUK80),
// },
// MemoryInGB: to.Ptr[float64](1.5),
// },
// },
// VolumeMounts: []*armcontainerinstance.VolumeMount{
// {
// Name: to.Ptr("volume1"),
// MountPath: to.Ptr("/mnt/volume1"),
// ReadOnly: to.Ptr(false),
// },
// {
// Name: to.Ptr("volume2"),
// MountPath: to.Ptr("/mnt/volume2"),
// ReadOnly: to.Ptr(false),
// },
// {
// Name: to.Ptr("volume3"),
// MountPath: to.Ptr("/mnt/volume3"),
// ReadOnly: to.Ptr(true),
// },
// },
// },
// },
// },
// Diagnostics: &armcontainerinstance.ContainerGroupDiagnostics{
// LogAnalytics: &armcontainerinstance.LogAnalytics{
// WorkspaceID: to.Ptr("workspaceid"),
// },
// },
// DNSConfig: &armcontainerinstance.DNSConfiguration{
// NameServers: []*string{
// to.Ptr("1.1.1.1"),
// },
// Options: to.Ptr("ndots:2"),
// SearchDomains: to.Ptr("cluster.local svc.cluster.local"),
// },
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
// },
// IPAddress: &armcontainerinstance.IPAddress{
// Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
// AutoGeneratedDomainNameLabelScope: to.Ptr(armcontainerinstance.DNSNameLabelReusePolicyUnsecure),
// DNSNameLabel: to.Ptr("dnsnamelabel1"),
// Fqdn: to.Ptr("dnsnamelabel1.azure-container.io"),
// IP: to.Ptr("10.0.0.1"),
// Ports: []*armcontainerinstance.Port{
// {
// Port: to.Ptr[int32](80),
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
// },
// },
// },
// IsCreatedFromStandbyPool: to.Ptr(false),
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// Volumes: []*armcontainerinstance.Volume{
// {
// Name: to.Ptr("volume1"),
// AzureFile: &armcontainerinstance.AzureFileVolume{
// ShareName: to.Ptr("shareName"),
// StorageAccountName: to.Ptr("accountName"),
// },
// },
// {
// Name: to.Ptr("volume2"),
// EmptyDir: map[string]any{
// },
// },
// {
// Name: to.Ptr("volume3"),
// Secret: map[string]*string{
// },
// },
// },
// },
// Zones: []*string{
// to.Ptr("1"),
// },
// },
// }
}
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 create or update container groups with specified configurations.
*
* @summary create or update container groups with specified configurations.
* x-ms-original-file: 2026-07-01/ContainerGroupsCreateOrUpdate.json
*/
async function containerGroupsCreateOrUpdate() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.createOrUpdate("demo", "demo1", {
identity: {
type: "SystemAssigned, UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name":
{},
},
},
location: "west us",
containers: [
{
name: "demo1",
command: [],
environmentVariables: [],
image: "nginx",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, gpu: { count: 1, sku: "K80" }, memoryInGB: 1.5 } },
volumeMounts: [
{ name: "volume1", mountPath: "/mnt/volume1", readOnly: false },
{ name: "volume2", mountPath: "/mnt/volume2", readOnly: false },
{ name: "volume3", mountPath: "/mnt/volume3", readOnly: true },
],
},
],
diagnostics: {
logAnalytics: {
logType: "ContainerInsights",
metadata: { "test-key": "test-metadata-value" },
workspaceId: "workspaceid",
workspaceKey: "workspaceKey",
workspaceResourceId:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
},
},
dnsConfig: {
nameServers: ["1.1.1.1"],
options: "ndots:2",
searchDomains: "cluster.local svc.cluster.local",
},
imageRegistryCredentials: [],
ipAddress: {
type: "Public",
autoGeneratedDomainNameLabelScope: "Unsecure",
dnsNameLabel: "dnsnamelabel1",
ports: [{ port: 80, protocol: "TCP" }],
},
osType: "Linux",
subnetIds: [
{
id: "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]",
},
],
volumes: [
{
name: "volume1",
azureFile: {
shareName: "shareName",
storageAccountKey: "accountKey",
storageAccountName: "accountName",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: { secretKey1: "SecretValue1InBase64", secretKey2: "SecretValue2InBase64" },
},
],
});
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
応答のサンプル
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "WestUs",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"gpu": {
"count": 1,
"sku": "K80"
},
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"diagnostics": {
"logAnalytics": {
"workspaceId": "workspaceid"
}
},
"dnsConfig": {
"nameServers": [
"1.1.1.1"
],
"options": "ndots:2",
"searchDomains": "cluster.local svc.cluster.local"
},
"imageRegistryCredentials": [],
"ipAddress": {
"type": "Public",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"fqdn": "dnsnamelabel1.azure-container.io",
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Succeeded",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {}
}
]
},
"zones": [
"1"
]
}
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "WestUs",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"gpu": {
"count": 1,
"sku": "K80"
},
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"dnsConfig": {
"nameServers": [
"1.1.1.1"
]
},
"imageRegistryCredentials": [],
"ipAddress": {
"type": "Public",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"fqdn": "dnsnamelabel1.azure-container.io",
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Succeeded",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {}
}
]
},
"zones": [
"1"
]
}
ContainerGroupsCreateOrUpdateManagedIdentityAzureFileshare
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2026-07-01
{
"identity": {
"type": "SystemAssigned, UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}
}
},
"location": "west us",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"gpu": {
"count": 1,
"sku": "K80"
},
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"diagnostics": {
"logAnalytics": {
"logType": "ContainerInsights",
"metadata": {
"test-key": "test-metadata-value"
},
"workspaceId": "workspaceid",
"workspaceKey": "workspaceKey",
"workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"
}
},
"dnsConfig": {
"nameServers": [
"1.1.1.1"
],
"options": "ndots:2",
"searchDomains": "cluster.local svc.cluster.local"
},
"imageRegistryCredentials": [],
"ipAddress": {
"type": "Public",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"osType": "Linux",
"subnetIds": [
{
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
}
],
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName",
"userManagedIdentityClientId": "00000000-0000-0000-0000-000000000000"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {
"secretKey1": "SecretValue1InBase64",
"secretKey2": "SecretValue2InBase64"
}
}
]
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.containerinstance.fluent.models.ContainerGroupInner;
import com.azure.resourcemanager.containerinstance.models.AzureFileVolume;
import com.azure.resourcemanager.containerinstance.models.Container;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupDiagnostics;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIdentity;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIdentityUserAssignedIdentities;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIpAddressType;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupNetworkProtocol;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupSubnetId;
import com.azure.resourcemanager.containerinstance.models.ContainerPort;
import com.azure.resourcemanager.containerinstance.models.DnsConfiguration;
import com.azure.resourcemanager.containerinstance.models.DnsNameLabelReusePolicy;
import com.azure.resourcemanager.containerinstance.models.GpuResource;
import com.azure.resourcemanager.containerinstance.models.GpuSku;
import com.azure.resourcemanager.containerinstance.models.IpAddress;
import com.azure.resourcemanager.containerinstance.models.LogAnalytics;
import com.azure.resourcemanager.containerinstance.models.LogAnalyticsLogType;
import com.azure.resourcemanager.containerinstance.models.OperatingSystemTypes;
import com.azure.resourcemanager.containerinstance.models.Port;
import com.azure.resourcemanager.containerinstance.models.ResourceIdentityType;
import com.azure.resourcemanager.containerinstance.models.ResourceRequests;
import com.azure.resourcemanager.containerinstance.models.ResourceRequirements;
import com.azure.resourcemanager.containerinstance.models.Volume;
import com.azure.resourcemanager.containerinstance.models.VolumeMount;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ContainerGroups CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/ContainerGroupsCreateOrUpdateManagedIdentityAzureFileshare.json
*/
/**
* Sample code: ContainerGroupsCreateOrUpdateManagedIdentityAzureFileshare.
*
* @param manager Entry point to ContainerInstanceManager.
*/
public static void containerGroupsCreateOrUpdateManagedIdentityAzureFileshare(
com.azure.resourcemanager.containerinstance.ContainerInstanceManager manager) throws IOException {
manager.serviceClient().getContainerGroups().createOrUpdate("demo", "demo1", new ContainerGroupInner()
.withLocation("west us")
.withIdentity(new ContainerGroupIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
new ContainerGroupIdentityUserAssignedIdentities())))
.withContainers(Arrays.asList(new Container().withName("demo1").withImage("nginx")
.withCommand(Arrays.asList()).withPorts(Arrays.asList(new ContainerPort().withPort(80)))
.withEnvironmentVariables(Arrays.asList())
.withResources(new ResourceRequirements().withRequests(new ResourceRequests().withMemoryInGB(1.5)
.withCpu(1.0).withGpu(new GpuResource().withCount(1).withSku(GpuSku.K80))))
.withVolumeMounts(Arrays.asList(
new VolumeMount().withName("volume1").withMountPath("/mnt/volume1").withReadOnly(false),
new VolumeMount().withName("volume2").withMountPath("/mnt/volume2").withReadOnly(false),
new VolumeMount().withName("volume3").withMountPath("/mnt/volume3").withReadOnly(true)))))
.withImageRegistryCredentials(Arrays.asList())
.withIpAddress(new IpAddress()
.withPorts(Arrays.asList(new Port().withProtocol(ContainerGroupNetworkProtocol.TCP).withPort(80)))
.withType(ContainerGroupIpAddressType.PUBLIC).withDnsNameLabel("dnsnamelabel1")
.withAutoGeneratedDomainNameLabelScope(DnsNameLabelReusePolicy.UNSECURE))
.withOsType(OperatingSystemTypes.LINUX)
.withVolumes(Arrays.asList(new Volume().withName("volume1")
.withAzureFile(new AzureFileVolume().withShareName("shareName").withStorageAccountName("accountName")
.withUserAssignedIdentityClientId("00000000-0000-0000-0000-000000000000")),
new Volume().withName("volume2")
.withEmptyDir(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize("{}",
Object.class, SerializerEncoding.JSON)),
new Volume().withName("volume3")
.withSecret(mapOf("secretKey1", "fakeTokenPlaceholder", "secretKey2", "fakeTokenPlaceholder"))))
.withDiagnostics(new ContainerGroupDiagnostics().withLogAnalytics(new LogAnalytics()
.withWorkspaceId("workspaceid").withWorkspaceKey("fakeTokenPlaceholder")
.withLogType(LogAnalyticsLogType.CONTAINER_INSIGHTS)
.withMetadata(mapOf("test-key", "fakeTokenPlaceholder")).withWorkspaceResourceId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace")))
.withSubnetIds(Arrays.asList(new ContainerGroupSubnetId().withId(
"[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]")))
.withDnsConfig(new DnsConfiguration().withNameServers(Arrays.asList("1.1.1.1"))
.withSearchDomains("cluster.local svc.cluster.local").withOptions("ndots:2")),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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_create_or_update_managed_identity_azure_fileshare.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="SUBSCRIPTION_ID",
)
response = client.container_groups.begin_create_or_update(
resource_group_name="demo",
container_group_name="demo1",
container_group={
"identity": {
"type": "SystemAssigned, UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}
},
},
"location": "west us",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [{"port": 80}],
"resources": {"requests": {"cpu": 1, "gpu": {"count": 1, "sku": "K80"}, "memoryInGB": 1.5}},
"volumeMounts": [
{"mountPath": "/mnt/volume1", "name": "volume1", "readOnly": False},
{"mountPath": "/mnt/volume2", "name": "volume2", "readOnly": False},
{"mountPath": "/mnt/volume3", "name": "volume3", "readOnly": True},
],
},
}
],
"diagnostics": {
"logAnalytics": {
"logType": "ContainerInsights",
"metadata": {"test-key": "test-metadata-value"},
"workspaceId": "workspaceid",
"workspaceKey": "workspaceKey",
"workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
}
},
"dnsConfig": {
"nameServers": ["1.1.1.1"],
"options": "ndots:2",
"searchDomains": "cluster.local svc.cluster.local",
},
"imageRegistryCredentials": [],
"ipAddress": {
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"ports": [{"port": 80, "protocol": "TCP"}],
"type": "Public",
},
"osType": "Linux",
"subnetIds": [
{
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
}
],
"volumes": [
{
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName",
"userAssignedIdentityClientId": "00000000-0000-0000-0000-000000000000",
},
"name": "volume1",
},
{"emptyDir": {}, "name": "volume2"},
{
"name": "volume3",
"secret": {"secretKey1": "SecretValue1InBase64", "secretKey2": "SecretValue2InBase64"},
},
],
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/ContainerGroupsCreateOrUpdateManagedIdentityAzureFileshare.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v3"
)
// Generated from example definition: 2026-07-01/ContainerGroupsCreateOrUpdateManagedIdentityAzureFileshare.json
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateOrUpdateManagedIdentityAzureFileshare() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
Identity: &armcontainerinstance.ContainerGroupIdentity{
Type: to.Ptr(armcontainerinstance.ResourceIdentityTypeSystemAssignedUserAssigned),
UserAssignedIdentities: map[string]*armcontainerinstance.UserAssignedIdentities{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {},
},
},
Location: to.Ptr("west us"),
Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
Containers: []*armcontainerinstance.Container{
{
Name: to.Ptr("demo1"),
Properties: &armcontainerinstance.ContainerProperties{
Command: []*string{},
EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{},
Image: to.Ptr("nginx"),
Ports: []*armcontainerinstance.ContainerPort{
{
Port: to.Ptr[int32](80),
},
},
Resources: &armcontainerinstance.ResourceRequirements{
Requests: &armcontainerinstance.ResourceRequests{
CPU: to.Ptr[float64](1),
Gpu: &armcontainerinstance.GpuResource{
Count: to.Ptr[int32](1),
SKU: to.Ptr(armcontainerinstance.GpuSKUK80),
},
MemoryInGB: to.Ptr[float64](1.5),
},
},
VolumeMounts: []*armcontainerinstance.VolumeMount{
{
Name: to.Ptr("volume1"),
MountPath: to.Ptr("/mnt/volume1"),
ReadOnly: to.Ptr(false),
},
{
Name: to.Ptr("volume2"),
MountPath: to.Ptr("/mnt/volume2"),
ReadOnly: to.Ptr(false),
},
{
Name: to.Ptr("volume3"),
MountPath: to.Ptr("/mnt/volume3"),
ReadOnly: to.Ptr(true),
},
},
},
},
},
Diagnostics: &armcontainerinstance.ContainerGroupDiagnostics{
LogAnalytics: &armcontainerinstance.LogAnalytics{
LogType: to.Ptr(armcontainerinstance.LogAnalyticsLogTypeContainerInsights),
Metadata: map[string]*string{
"test-key": to.Ptr("test-metadata-value"),
},
WorkspaceID: to.Ptr("workspaceid"),
WorkspaceKey: to.Ptr("workspaceKey"),
WorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"),
},
},
DNSConfig: &armcontainerinstance.DNSConfiguration{
NameServers: []*string{
to.Ptr("1.1.1.1"),
},
Options: to.Ptr("ndots:2"),
SearchDomains: to.Ptr("cluster.local svc.cluster.local"),
},
ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{},
IPAddress: &armcontainerinstance.IPAddress{
Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
AutoGeneratedDomainNameLabelScope: to.Ptr(armcontainerinstance.DNSNameLabelReusePolicyUnsecure),
DNSNameLabel: to.Ptr("dnsnamelabel1"),
Ports: []*armcontainerinstance.Port{
{
Port: to.Ptr[int32](80),
Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
},
},
},
OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
SubnetIDs: []*armcontainerinstance.ContainerGroupSubnetID{
{
ID: to.Ptr("[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"),
},
},
Volumes: []*armcontainerinstance.Volume{
{
Name: to.Ptr("volume1"),
AzureFile: &armcontainerinstance.AzureFileVolume{
ShareName: to.Ptr("shareName"),
StorageAccountName: to.Ptr("accountName"),
UserAssignedIdentityClientID: to.Ptr("00000000-0000-0000-0000-000000000000"),
},
},
{
Name: to.Ptr("volume2"),
EmptyDir: map[string]any{},
},
{
Name: to.Ptr("volume3"),
Secret: map[string]*string{
"secretKey1": to.Ptr("SecretValue1InBase64"),
"secretKey2": to.Ptr("SecretValue2InBase64"),
},
},
},
},
}, 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 poll 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 = armcontainerinstance.ContainerGroupsClientCreateOrUpdateResponse{
// ContainerGroup: armcontainerinstance.ContainerGroup{
// Name: to.Ptr("demo1"),
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
// Location: to.Ptr("WestUs"),
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
// Containers: []*armcontainerinstance.Container{
// {
// Name: to.Ptr("demo1"),
// Properties: &armcontainerinstance.ContainerProperties{
// Command: []*string{
// },
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
// },
// Image: to.Ptr("nginx"),
// Ports: []*armcontainerinstance.ContainerPort{
// {
// Port: to.Ptr[int32](80),
// },
// },
// Resources: &armcontainerinstance.ResourceRequirements{
// Requests: &armcontainerinstance.ResourceRequests{
// CPU: to.Ptr[float64](1),
// Gpu: &armcontainerinstance.GpuResource{
// Count: to.Ptr[int32](1),
// SKU: to.Ptr(armcontainerinstance.GpuSKUK80),
// },
// MemoryInGB: to.Ptr[float64](1.5),
// },
// },
// VolumeMounts: []*armcontainerinstance.VolumeMount{
// {
// Name: to.Ptr("volume1"),
// MountPath: to.Ptr("/mnt/volume1"),
// ReadOnly: to.Ptr(false),
// },
// {
// Name: to.Ptr("volume2"),
// MountPath: to.Ptr("/mnt/volume2"),
// ReadOnly: to.Ptr(false),
// },
// {
// Name: to.Ptr("volume3"),
// MountPath: to.Ptr("/mnt/volume3"),
// ReadOnly: to.Ptr(true),
// },
// },
// },
// },
// },
// Diagnostics: &armcontainerinstance.ContainerGroupDiagnostics{
// LogAnalytics: &armcontainerinstance.LogAnalytics{
// WorkspaceID: to.Ptr("workspaceid"),
// },
// },
// DNSConfig: &armcontainerinstance.DNSConfiguration{
// NameServers: []*string{
// to.Ptr("1.1.1.1"),
// },
// Options: to.Ptr("ndots:2"),
// SearchDomains: to.Ptr("cluster.local svc.cluster.local"),
// },
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
// },
// IPAddress: &armcontainerinstance.IPAddress{
// Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
// AutoGeneratedDomainNameLabelScope: to.Ptr(armcontainerinstance.DNSNameLabelReusePolicyUnsecure),
// DNSNameLabel: to.Ptr("dnsnamelabel1"),
// Fqdn: to.Ptr("dnsnamelabel1.azure-container.io"),
// IP: to.Ptr("10.0.0.1"),
// Ports: []*armcontainerinstance.Port{
// {
// Port: to.Ptr[int32](80),
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
// },
// },
// },
// IsCreatedFromStandbyPool: to.Ptr(false),
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// Volumes: []*armcontainerinstance.Volume{
// {
// Name: to.Ptr("volume1"),
// AzureFile: &armcontainerinstance.AzureFileVolume{
// ShareName: to.Ptr("shareName"),
// StorageAccountName: to.Ptr("accountName"),
// UserAssignedIdentityClientID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// },
// },
// {
// Name: to.Ptr("volume2"),
// EmptyDir: map[string]any{
// },
// },
// {
// Name: to.Ptr("volume3"),
// Secret: map[string]*string{
// },
// },
// },
// },
// Identity: &armcontainerinstance.ContainerGroupIdentity{
// UserAssignedIdentities: map[string]*armcontainerinstance.UserAssignedIdentities{
// "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": &armcontainerinstance.UserAssignedIdentities{
// PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// },
// },
// TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Type: to.Ptr(armcontainerinstance.ResourceIdentityTypeUserAssigned),
// },
// Zones: []*string{
// to.Ptr("1"),
// },
// },
// }
}
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 create or update container groups with specified configurations.
*
* @summary create or update container groups with specified configurations.
* x-ms-original-file: 2026-07-01/ContainerGroupsCreateOrUpdateManagedIdentityAzureFileshare.json
*/
async function containerGroupsCreateOrUpdateManagedIdentityAzureFileshare() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.createOrUpdate("demo", "demo1", {
identity: {
type: "SystemAssigned, UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name":
{},
},
},
location: "west us",
containers: [
{
name: "demo1",
command: [],
environmentVariables: [],
image: "nginx",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, gpu: { count: 1, sku: "K80" }, memoryInGB: 1.5 } },
volumeMounts: [
{ name: "volume1", mountPath: "/mnt/volume1", readOnly: false },
{ name: "volume2", mountPath: "/mnt/volume2", readOnly: false },
{ name: "volume3", mountPath: "/mnt/volume3", readOnly: true },
],
},
],
diagnostics: {
logAnalytics: {
logType: "ContainerInsights",
metadata: { "test-key": "test-metadata-value" },
workspaceId: "workspaceid",
workspaceKey: "workspaceKey",
workspaceResourceId:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
},
},
dnsConfig: {
nameServers: ["1.1.1.1"],
options: "ndots:2",
searchDomains: "cluster.local svc.cluster.local",
},
imageRegistryCredentials: [],
ipAddress: {
type: "Public",
autoGeneratedDomainNameLabelScope: "Unsecure",
dnsNameLabel: "dnsnamelabel1",
ports: [{ port: 80, protocol: "TCP" }],
},
osType: "Linux",
subnetIds: [
{
id: "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]",
},
],
volumes: [
{
name: "volume1",
azureFile: {
shareName: "shareName",
storageAccountName: "accountName",
userAssignedIdentityClientId: "00000000-0000-0000-0000-000000000000",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: { secretKey1: "SecretValue1InBase64", secretKey2: "SecretValue2InBase64" },
},
],
});
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
応答のサンプル
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "WestUs",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"gpu": {
"count": 1,
"sku": "K80"
},
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"diagnostics": {
"logAnalytics": {
"workspaceId": "workspaceid"
}
},
"dnsConfig": {
"nameServers": [
"1.1.1.1"
],
"options": "ndots:2",
"searchDomains": "cluster.local svc.cluster.local"
},
"imageRegistryCredentials": [],
"ipAddress": {
"type": "Public",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"fqdn": "dnsnamelabel1.azure-container.io",
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Succeeded",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName",
"userManagedIdentityClientId": "00000000-0000-0000-0000-000000000000"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {}
}
]
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {
"principalId": "00000000-0000-0000-0000-000000000000",
"clientId": "00000000-0000-0000-0000-000000000000"
}
},
"tenantId": "00000000-0000-0000-0000-000000000000",
"type": "UserAssigned"
},
"zones": [
"1"
]
}
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "WestUs",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"gpu": {
"count": 1,
"sku": "K80"
},
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"dnsConfig": {
"nameServers": [
"1.1.1.1"
]
},
"imageRegistryCredentials": [],
"ipAddress": {
"type": "Public",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"fqdn": "dnsnamelabel1.azure-container.io",
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Succeeded",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName",
"userManagedIdentityClientId": "00000000-0000-0000-0000-000000000000"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {}
}
]
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {
"principalId": "00000000-0000-0000-0000-000000000000",
"clientId": "00000000-0000-0000-0000-000000000000"
}
},
"tenantId": "00000000-0000-0000-0000-000000000000",
"type": "UserAssigned"
},
"zones": [
"1"
]
}
ContainerGroupsCreateOrUpdateSecretReference
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2026-07-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}
}
},
"location": "west us",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [
{
"name": "envSecret",
"secureValueReference": "envSecretRef"
}
],
"image": "privateRegistryImage",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"gpu": {
"count": 1,
"sku": "K80"
},
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"diagnostics": {
"logAnalytics": {
"logType": "ContainerInsights",
"metadata": {
"test-key": "test-metadata-value"
},
"workspaceId": "workspaceid",
"workspaceKey": "workspaceKey",
"workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"
}
},
"dnsConfig": {
"nameServers": [
"1.1.1.1"
],
"options": "ndots:2",
"searchDomains": "cluster.local svc.cluster.local"
},
"imageRegistryCredentials": [
{
"passwordReference": "privateRegistryKeyRef",
"server": "demoregistry.azurecr.io",
"username": "registryUserName"
}
],
"ipAddress": {
"type": "Public",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"osType": "Linux",
"secretReferences": [
{
"name": "envSecretRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/envSecret"
},
{
"name": "accountKeyRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/accountKey"
},
{
"name": "volumeSecretRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/volumeSecret"
},
{
"name": "privateRegistryKeyRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/privateRegistryKey"
}
],
"subnetIds": [
{
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
}
],
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountKeyReference": "accountKeyRef",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {
"secretKey1": "SecretValue1InBase64"
},
"secretReference": {
"secretKey2": "volumeSecretRef"
}
}
]
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.containerinstance.fluent.models.ContainerGroupInner;
import com.azure.resourcemanager.containerinstance.models.AzureFileVolume;
import com.azure.resourcemanager.containerinstance.models.Container;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupDiagnostics;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIdentity;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIdentityUserAssignedIdentities;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIpAddressType;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupNetworkProtocol;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupSubnetId;
import com.azure.resourcemanager.containerinstance.models.ContainerPort;
import com.azure.resourcemanager.containerinstance.models.DnsConfiguration;
import com.azure.resourcemanager.containerinstance.models.DnsNameLabelReusePolicy;
import com.azure.resourcemanager.containerinstance.models.EnvironmentVariable;
import com.azure.resourcemanager.containerinstance.models.GpuResource;
import com.azure.resourcemanager.containerinstance.models.GpuSku;
import com.azure.resourcemanager.containerinstance.models.ImageRegistryCredential;
import com.azure.resourcemanager.containerinstance.models.IpAddress;
import com.azure.resourcemanager.containerinstance.models.LogAnalytics;
import com.azure.resourcemanager.containerinstance.models.LogAnalyticsLogType;
import com.azure.resourcemanager.containerinstance.models.OperatingSystemTypes;
import com.azure.resourcemanager.containerinstance.models.Port;
import com.azure.resourcemanager.containerinstance.models.ResourceIdentityType;
import com.azure.resourcemanager.containerinstance.models.ResourceRequests;
import com.azure.resourcemanager.containerinstance.models.ResourceRequirements;
import com.azure.resourcemanager.containerinstance.models.SecretReference;
import com.azure.resourcemanager.containerinstance.models.Volume;
import com.azure.resourcemanager.containerinstance.models.VolumeMount;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ContainerGroups CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/ContainerGroupsCreateOrUpdateSecretReference.json
*/
/**
* Sample code: ContainerGroupsCreateOrUpdateSecretReference.
*
* @param manager Entry point to ContainerInstanceManager.
*/
public static void containerGroupsCreateOrUpdateSecretReference(
com.azure.resourcemanager.containerinstance.ContainerInstanceManager manager) throws IOException {
manager.serviceClient().getContainerGroups().createOrUpdate("demo", "demo1", new ContainerGroupInner()
.withLocation("west us")
.withIdentity(new ContainerGroupIdentity().withType(ResourceIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
new ContainerGroupIdentityUserAssignedIdentities())))
.withSecretReferences(Arrays.asList(new SecretReference().withName("envSecretRef").withIdentity(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name")
.withSecretReferenceUri("fakeTokenPlaceholder"),
new SecretReference().withName("accountKeyRef").withIdentity(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name")
.withSecretReferenceUri("fakeTokenPlaceholder"),
new SecretReference().withName("volumeSecretRef").withIdentity(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name")
.withSecretReferenceUri("fakeTokenPlaceholder"),
new SecretReference().withName("privateRegistryKeyRef").withIdentity(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name")
.withSecretReferenceUri("fakeTokenPlaceholder")))
.withContainers(Arrays.asList(new Container().withName("demo1").withImage("privateRegistryImage")
.withCommand(Arrays.asList()).withPorts(Arrays.asList(new ContainerPort().withPort(80)))
.withEnvironmentVariables(Arrays
.asList(new EnvironmentVariable().withName("envSecret").withSecureValueReference("envSecretRef")))
.withResources(new ResourceRequirements().withRequests(new ResourceRequests().withMemoryInGB(1.5)
.withCpu(1.0).withGpu(new GpuResource().withCount(1).withSku(GpuSku.K80))))
.withVolumeMounts(Arrays.asList(
new VolumeMount().withName("volume1").withMountPath("/mnt/volume1").withReadOnly(false),
new VolumeMount().withName("volume2").withMountPath("/mnt/volume2").withReadOnly(false),
new VolumeMount().withName("volume3").withMountPath("/mnt/volume3").withReadOnly(true)))))
.withImageRegistryCredentials(
Arrays.asList(new ImageRegistryCredential().withServer("demoregistry.azurecr.io")
.withUsername("registryUserName").withPasswordReference("fakeTokenPlaceholder")))
.withIpAddress(new IpAddress()
.withPorts(Arrays.asList(new Port().withProtocol(ContainerGroupNetworkProtocol.TCP).withPort(80)))
.withType(ContainerGroupIpAddressType.PUBLIC).withDnsNameLabel("dnsnamelabel1")
.withAutoGeneratedDomainNameLabelScope(DnsNameLabelReusePolicy.UNSECURE))
.withOsType(OperatingSystemTypes.LINUX)
.withVolumes(Arrays.asList(
new Volume().withName("volume1")
.withAzureFile(new AzureFileVolume().withShareName("shareName")
.withStorageAccountName("accountName").withStorageAccountKeyReference("fakeTokenPlaceholder")),
new Volume().withName("volume2")
.withEmptyDir(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize("{}",
Object.class, SerializerEncoding.JSON)),
new Volume().withName("volume3").withSecret(mapOf("secretKey1", "fakeTokenPlaceholder"))
.withSecretReference(mapOf("secretKey2", "fakeTokenPlaceholder"))))
.withDiagnostics(new ContainerGroupDiagnostics().withLogAnalytics(new LogAnalytics()
.withWorkspaceId("workspaceid").withWorkspaceKey("fakeTokenPlaceholder")
.withLogType(LogAnalyticsLogType.CONTAINER_INSIGHTS)
.withMetadata(mapOf("test-key", "fakeTokenPlaceholder")).withWorkspaceResourceId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace")))
.withSubnetIds(Arrays.asList(new ContainerGroupSubnetId().withId(
"[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]")))
.withDnsConfig(new DnsConfiguration().withNameServers(Arrays.asList("1.1.1.1"))
.withSearchDomains("cluster.local svc.cluster.local").withOptions("ndots:2")),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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_create_or_update_secret_reference.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="SUBSCRIPTION_ID",
)
response = client.container_groups.begin_create_or_update(
resource_group_name="demo",
container_group_name="demo1",
container_group={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}
},
},
"location": "west us",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [{"name": "envSecret", "secureValueReference": "envSecretRef"}],
"image": "privateRegistryImage",
"ports": [{"port": 80}],
"resources": {"requests": {"cpu": 1, "gpu": {"count": 1, "sku": "K80"}, "memoryInGB": 1.5}},
"volumeMounts": [
{"mountPath": "/mnt/volume1", "name": "volume1", "readOnly": False},
{"mountPath": "/mnt/volume2", "name": "volume2", "readOnly": False},
{"mountPath": "/mnt/volume3", "name": "volume3", "readOnly": True},
],
},
}
],
"diagnostics": {
"logAnalytics": {
"logType": "ContainerInsights",
"metadata": {"test-key": "test-metadata-value"},
"workspaceId": "workspaceid",
"workspaceKey": "workspaceKey",
"workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
}
},
"dnsConfig": {
"nameServers": ["1.1.1.1"],
"options": "ndots:2",
"searchDomains": "cluster.local svc.cluster.local",
},
"imageRegistryCredentials": [
{
"passwordReference": "privateRegistryKeyRef",
"server": "demoregistry.azurecr.io",
"username": "registryUserName",
}
],
"ipAddress": {
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"ports": [{"port": 80, "protocol": "TCP"}],
"type": "Public",
},
"osType": "Linux",
"secretReferences": [
{
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"name": "envSecretRef",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/envSecret",
},
{
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"name": "accountKeyRef",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/accountKey",
},
{
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"name": "volumeSecretRef",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/volumeSecret",
},
{
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"name": "privateRegistryKeyRef",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/privateRegistryKey",
},
],
"subnetIds": [
{
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
}
],
"volumes": [
{
"azureFile": {
"shareName": "shareName",
"storageAccountKeyReference": "accountKeyRef",
"storageAccountName": "accountName",
},
"name": "volume1",
},
{"emptyDir": {}, "name": "volume2"},
{
"name": "volume3",
"secret": {"secretKey1": "SecretValue1InBase64"},
"secretReference": {"secretKey2": "volumeSecretRef"},
},
],
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/ContainerGroupsCreateOrUpdateSecretReference.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v3"
)
// Generated from example definition: 2026-07-01/ContainerGroupsCreateOrUpdateSecretReference.json
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateOrUpdateSecretReference() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
Identity: &armcontainerinstance.ContainerGroupIdentity{
Type: to.Ptr(armcontainerinstance.ResourceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armcontainerinstance.UserAssignedIdentities{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {},
},
},
Location: to.Ptr("west us"),
Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
Containers: []*armcontainerinstance.Container{
{
Name: to.Ptr("demo1"),
Properties: &armcontainerinstance.ContainerProperties{
Command: []*string{},
EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
{
Name: to.Ptr("envSecret"),
SecureValueReference: to.Ptr("envSecretRef"),
},
},
Image: to.Ptr("privateRegistryImage"),
Ports: []*armcontainerinstance.ContainerPort{
{
Port: to.Ptr[int32](80),
},
},
Resources: &armcontainerinstance.ResourceRequirements{
Requests: &armcontainerinstance.ResourceRequests{
CPU: to.Ptr[float64](1),
Gpu: &armcontainerinstance.GpuResource{
Count: to.Ptr[int32](1),
SKU: to.Ptr(armcontainerinstance.GpuSKUK80),
},
MemoryInGB: to.Ptr[float64](1.5),
},
},
VolumeMounts: []*armcontainerinstance.VolumeMount{
{
Name: to.Ptr("volume1"),
MountPath: to.Ptr("/mnt/volume1"),
ReadOnly: to.Ptr(false),
},
{
Name: to.Ptr("volume2"),
MountPath: to.Ptr("/mnt/volume2"),
ReadOnly: to.Ptr(false),
},
{
Name: to.Ptr("volume3"),
MountPath: to.Ptr("/mnt/volume3"),
ReadOnly: to.Ptr(true),
},
},
},
},
},
Diagnostics: &armcontainerinstance.ContainerGroupDiagnostics{
LogAnalytics: &armcontainerinstance.LogAnalytics{
LogType: to.Ptr(armcontainerinstance.LogAnalyticsLogTypeContainerInsights),
Metadata: map[string]*string{
"test-key": to.Ptr("test-metadata-value"),
},
WorkspaceID: to.Ptr("workspaceid"),
WorkspaceKey: to.Ptr("workspaceKey"),
WorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"),
},
},
DNSConfig: &armcontainerinstance.DNSConfiguration{
NameServers: []*string{
to.Ptr("1.1.1.1"),
},
Options: to.Ptr("ndots:2"),
SearchDomains: to.Ptr("cluster.local svc.cluster.local"),
},
ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
{
PasswordReference: to.Ptr("privateRegistryKeyRef"),
Server: to.Ptr("demoregistry.azurecr.io"),
Username: to.Ptr("registryUserName"),
},
},
IPAddress: &armcontainerinstance.IPAddress{
Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
AutoGeneratedDomainNameLabelScope: to.Ptr(armcontainerinstance.DNSNameLabelReusePolicyUnsecure),
DNSNameLabel: to.Ptr("dnsnamelabel1"),
Ports: []*armcontainerinstance.Port{
{
Port: to.Ptr[int32](80),
Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
},
},
},
OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
SecretReferences: []*armcontainerinstance.SecretReference{
{
Name: to.Ptr("envSecretRef"),
Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name"),
SecretReferenceURI: to.Ptr("https://keyvaultname.vault.azure.net/secrets/envSecret"),
},
{
Name: to.Ptr("accountKeyRef"),
Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name"),
SecretReferenceURI: to.Ptr("https://keyvaultname.vault.azure.net/secrets/accountKey"),
},
{
Name: to.Ptr("volumeSecretRef"),
Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name"),
SecretReferenceURI: to.Ptr("https://keyvaultname.vault.azure.net/secrets/volumeSecret"),
},
{
Name: to.Ptr("privateRegistryKeyRef"),
Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name"),
SecretReferenceURI: to.Ptr("https://keyvaultname.vault.azure.net/secrets/privateRegistryKey"),
},
},
SubnetIDs: []*armcontainerinstance.ContainerGroupSubnetID{
{
ID: to.Ptr("[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"),
},
},
Volumes: []*armcontainerinstance.Volume{
{
Name: to.Ptr("volume1"),
AzureFile: &armcontainerinstance.AzureFileVolume{
ShareName: to.Ptr("shareName"),
StorageAccountKeyReference: to.Ptr("accountKeyRef"),
StorageAccountName: to.Ptr("accountName"),
},
},
{
Name: to.Ptr("volume2"),
EmptyDir: map[string]any{},
},
{
Name: to.Ptr("volume3"),
Secret: map[string]*string{
"secretKey1": to.Ptr("SecretValue1InBase64"),
},
SecretReference: map[string]*string{
"secretKey2": to.Ptr("volumeSecretRef"),
},
},
},
},
}, 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 poll 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 = armcontainerinstance.ContainerGroupsClientCreateOrUpdateResponse{
// ContainerGroup: armcontainerinstance.ContainerGroup{
// Name: to.Ptr("demo1"),
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
// Identity: &armcontainerinstance.ContainerGroupIdentity{
// Type: to.Ptr(armcontainerinstance.ResourceIdentityTypeUserAssigned),
// TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// UserAssignedIdentities: map[string]*armcontainerinstance.UserAssignedIdentities{
// "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": &armcontainerinstance.UserAssignedIdentities{
// ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// },
// },
// },
// Location: to.Ptr("WestUs"),
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
// Containers: []*armcontainerinstance.Container{
// {
// Name: to.Ptr("demo1"),
// Properties: &armcontainerinstance.ContainerProperties{
// Command: []*string{
// },
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
// {
// Name: to.Ptr("envSecret"),
// SecureValueReference: to.Ptr("envSecretRef"),
// },
// },
// Image: to.Ptr("privateRegistryImage"),
// Ports: []*armcontainerinstance.ContainerPort{
// {
// Port: to.Ptr[int32](80),
// },
// },
// Resources: &armcontainerinstance.ResourceRequirements{
// Requests: &armcontainerinstance.ResourceRequests{
// CPU: to.Ptr[float64](1),
// Gpu: &armcontainerinstance.GpuResource{
// Count: to.Ptr[int32](1),
// SKU: to.Ptr(armcontainerinstance.GpuSKUK80),
// },
// MemoryInGB: to.Ptr[float64](1.5),
// },
// },
// VolumeMounts: []*armcontainerinstance.VolumeMount{
// {
// Name: to.Ptr("volume1"),
// MountPath: to.Ptr("/mnt/volume1"),
// ReadOnly: to.Ptr(false),
// },
// {
// Name: to.Ptr("volume2"),
// MountPath: to.Ptr("/mnt/volume2"),
// ReadOnly: to.Ptr(false),
// },
// {
// Name: to.Ptr("volume3"),
// MountPath: to.Ptr("/mnt/volume3"),
// ReadOnly: to.Ptr(true),
// },
// },
// },
// },
// },
// Diagnostics: &armcontainerinstance.ContainerGroupDiagnostics{
// LogAnalytics: &armcontainerinstance.LogAnalytics{
// WorkspaceID: to.Ptr("workspaceid"),
// },
// },
// DNSConfig: &armcontainerinstance.DNSConfiguration{
// NameServers: []*string{
// to.Ptr("1.1.1.1"),
// },
// Options: to.Ptr("ndots:2"),
// SearchDomains: to.Ptr("cluster.local svc.cluster.local"),
// },
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
// {
// PasswordReference: to.Ptr("privateRegistryKeyRef"),
// Server: to.Ptr("demoregistry.azurecr.io"),
// Username: to.Ptr("registryUserName"),
// },
// },
// IPAddress: &armcontainerinstance.IPAddress{
// Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
// AutoGeneratedDomainNameLabelScope: to.Ptr(armcontainerinstance.DNSNameLabelReusePolicyUnsecure),
// DNSNameLabel: to.Ptr("dnsnamelabel1"),
// Fqdn: to.Ptr("dnsnamelabel1.azure-container.io"),
// IP: to.Ptr("10.0.0.1"),
// Ports: []*armcontainerinstance.Port{
// {
// Port: to.Ptr[int32](80),
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
// },
// },
// },
// IsCreatedFromStandbyPool: to.Ptr(false),
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// SecretReferences: []*armcontainerinstance.SecretReference{
// {
// Name: to.Ptr("envSecretRef"),
// Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name"),
// SecretReferenceURI: to.Ptr("https://keyvaultname.vault.azure.net/secrets/envSecret"),
// },
// {
// Name: to.Ptr("accountKeyRef"),
// Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name"),
// SecretReferenceURI: to.Ptr("https://keyvaultname.vault.azure.net/secrets/accountKey"),
// },
// {
// Name: to.Ptr("volumeSecretRef"),
// Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name"),
// SecretReferenceURI: to.Ptr("https://keyvaultname.vault.azure.net/secrets/volumeSecret"),
// },
// {
// Name: to.Ptr("privateRegistryKeyRef"),
// Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name"),
// SecretReferenceURI: to.Ptr("https://keyvaultname.vault.azure.net/secrets/privateRegistryKey"),
// },
// },
// Volumes: []*armcontainerinstance.Volume{
// {
// Name: to.Ptr("volume1"),
// AzureFile: &armcontainerinstance.AzureFileVolume{
// ShareName: to.Ptr("shareName"),
// StorageAccountKeyReference: to.Ptr("accountKeyRef"),
// StorageAccountName: to.Ptr("accountName"),
// },
// },
// {
// Name: to.Ptr("volume2"),
// EmptyDir: map[string]any{
// },
// },
// {
// Name: to.Ptr("volume3"),
// Secret: map[string]*string{
// },
// SecretReference: map[string]*string{
// "secretKey2": to.Ptr("volumeSecretRef"),
// },
// },
// },
// },
// Zones: []*string{
// to.Ptr("1"),
// },
// },
// }
}
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 create or update container groups with specified configurations.
*
* @summary create or update container groups with specified configurations.
* x-ms-original-file: 2026-07-01/ContainerGroupsCreateOrUpdateSecretReference.json
*/
async function containerGroupsCreateOrUpdateSecretReference() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.createOrUpdate("demo", "demo1", {
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name":
{},
},
},
location: "west us",
containers: [
{
name: "demo1",
command: [],
environmentVariables: [{ name: "envSecret", secureValueReference: "envSecretRef" }],
image: "privateRegistryImage",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, gpu: { count: 1, sku: "K80" }, memoryInGB: 1.5 } },
volumeMounts: [
{ name: "volume1", mountPath: "/mnt/volume1", readOnly: false },
{ name: "volume2", mountPath: "/mnt/volume2", readOnly: false },
{ name: "volume3", mountPath: "/mnt/volume3", readOnly: true },
],
},
],
diagnostics: {
logAnalytics: {
logType: "ContainerInsights",
metadata: { "test-key": "test-metadata-value" },
workspaceId: "workspaceid",
workspaceKey: "workspaceKey",
workspaceResourceId:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
},
},
dnsConfig: {
nameServers: ["1.1.1.1"],
options: "ndots:2",
searchDomains: "cluster.local svc.cluster.local",
},
imageRegistryCredentials: [
{
passwordReference: "privateRegistryKeyRef",
server: "demoregistry.azurecr.io",
username: "registryUserName",
},
],
ipAddress: {
type: "Public",
autoGeneratedDomainNameLabelScope: "Unsecure",
dnsNameLabel: "dnsnamelabel1",
ports: [{ port: 80, protocol: "TCP" }],
},
osType: "Linux",
secretReferences: [
{
name: "envSecretRef",
identity:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
secretReferenceUri: "https://keyvaultname.vault.azure.net/secrets/envSecret",
},
{
name: "accountKeyRef",
identity:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
secretReferenceUri: "https://keyvaultname.vault.azure.net/secrets/accountKey",
},
{
name: "volumeSecretRef",
identity:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
secretReferenceUri: "https://keyvaultname.vault.azure.net/secrets/volumeSecret",
},
{
name: "privateRegistryKeyRef",
identity:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
secretReferenceUri: "https://keyvaultname.vault.azure.net/secrets/privateRegistryKey",
},
],
subnetIds: [
{
id: "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]",
},
],
volumes: [
{
name: "volume1",
azureFile: {
shareName: "shareName",
storageAccountKeyReference: "accountKeyRef",
storageAccountName: "accountName",
},
},
{ name: "volume2", emptyDir: {} },
{
name: "volume3",
secret: { secretKey1: "SecretValue1InBase64" },
secretReference: { secretKey2: "volumeSecretRef" },
},
],
});
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
応答のサンプル
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"identity": {
"type": "UserAssigned",
"tenantId": "00000000-0000-0000-0000-000000000000",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {
"clientId": "00000000-0000-0000-0000-000000000000",
"principalId": "00000000-0000-0000-0000-000000000000"
}
}
},
"location": "WestUs",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [
{
"name": "envSecret",
"secureValueReference": "envSecretRef"
}
],
"image": "privateRegistryImage",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"gpu": {
"count": 1,
"sku": "K80"
},
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"diagnostics": {
"logAnalytics": {
"workspaceId": "workspaceid"
}
},
"dnsConfig": {
"nameServers": [
"1.1.1.1"
],
"options": "ndots:2",
"searchDomains": "cluster.local svc.cluster.local"
},
"imageRegistryCredentials": [
{
"passwordReference": "privateRegistryKeyRef",
"server": "demoregistry.azurecr.io",
"username": "registryUserName"
}
],
"ipAddress": {
"type": "Public",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"fqdn": "dnsnamelabel1.azure-container.io",
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Succeeded",
"secretReferences": [
{
"name": "envSecretRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/envSecret"
},
{
"name": "accountKeyRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/accountKey"
},
{
"name": "volumeSecretRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/volumeSecret"
},
{
"name": "privateRegistryKeyRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/privateRegistryKey"
}
],
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountKeyReference": "accountKeyRef",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {},
"secretReference": {
"secretKey2": "volumeSecretRef"
}
}
]
},
"zones": [
"1"
]
}
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"identity": {
"type": "UserAssigned",
"tenantId": "00000000-0000-0000-0000-000000000000",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {
"clientId": "00000000-0000-0000-0000-000000000000",
"principalId": "00000000-0000-0000-0000-000000000000"
}
}
},
"location": "WestUs",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [
{
"name": "envSecret",
"secureValueReference": "envSecretRef"
}
],
"image": "privateRegistryImage",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"gpu": {
"count": 1,
"sku": "K80"
},
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"dnsConfig": {
"nameServers": [
"1.1.1.1"
]
},
"imageRegistryCredentials": [
{
"passwordReference": "privateRegistryKeyRef",
"server": "demoregistry.azurecr.io",
"username": "registryUserName"
}
],
"ipAddress": {
"type": "Public",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"dnsNameLabel": "dnsnamelabel1",
"fqdn": "dnsnamelabel1.azure-container.io",
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Succeeded",
"secretReferences": [
{
"name": "envSecretRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/envSecret"
},
{
"name": "accountKeyRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/accountKey"
},
{
"name": "volumeSecretRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/volumeSecret"
},
{
"name": "privateRegistryKeyRef",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name",
"secretReferenceUri": "https://keyvaultname.vault.azure.net/secrets/privateRegistryKey"
}
],
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountKeyReference": "accountKeyRef",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {},
"secretReference": {
"secretKey2": "volumeSecretRef"
}
}
]
},
"zones": [
"1"
]
}
ContainerGroupsCreateWithPriority
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2026-07-01
{
"location": "eastus",
"properties": {
"containers": [
{
"name": "test-container-001",
"properties": {
"command": [
"/bin/sh",
"-c",
"sleep 10"
],
"image": "alpine:latest",
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1
}
}
}
}
],
"osType": "Linux",
"priority": "Spot",
"restartPolicy": "Never",
"sku": "Standard"
}
}
import com.azure.resourcemanager.containerinstance.fluent.models.ContainerGroupInner;
import com.azure.resourcemanager.containerinstance.models.Container;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupPriority;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupRestartPolicy;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupSku;
import com.azure.resourcemanager.containerinstance.models.OperatingSystemTypes;
import com.azure.resourcemanager.containerinstance.models.ResourceRequests;
import com.azure.resourcemanager.containerinstance.models.ResourceRequirements;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ContainerGroups CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/ContainerGroupsCreatePriority.json
*/
/**
* Sample code: ContainerGroupsCreateWithPriority.
*
* @param manager Entry point to ContainerInstanceManager.
*/
public static void containerGroupsCreateWithPriority(
com.azure.resourcemanager.containerinstance.ContainerInstanceManager manager) {
manager.serviceClient().getContainerGroups().createOrUpdate("demo", "demo1", new ContainerGroupInner()
.withLocation("eastus")
.withContainers(Arrays.asList(new Container().withName("test-container-001").withImage("alpine:latest")
.withCommand(Arrays.asList("/bin/sh", "-c", "sleep 10")).withResources(
new ResourceRequirements().withRequests(new ResourceRequests().withMemoryInGB(1.0).withCpu(1.0)))))
.withRestartPolicy(ContainerGroupRestartPolicy.NEVER).withOsType(OperatingSystemTypes.LINUX)
.withSku(ContainerGroupSku.STANDARD).withPriority(ContainerGroupPriority.SPOT),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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_create_priority.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="SUBSCRIPTION_ID",
)
response = client.container_groups.begin_create_or_update(
resource_group_name="demo",
container_group_name="demo1",
container_group={
"location": "eastus",
"properties": {
"containers": [
{
"name": "test-container-001",
"properties": {
"command": ["/bin/sh", "-c", "sleep 10"],
"image": "alpine:latest",
"resources": {"requests": {"cpu": 1, "memoryInGB": 1}},
},
}
],
"osType": "Linux",
"priority": "Spot",
"restartPolicy": "Never",
"sku": "Standard",
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/ContainerGroupsCreatePriority.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v3"
)
// Generated from example definition: 2026-07-01/ContainerGroupsCreatePriority.json
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateWithPriority() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
Location: to.Ptr("eastus"),
Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
Containers: []*armcontainerinstance.Container{
{
Name: to.Ptr("test-container-001"),
Properties: &armcontainerinstance.ContainerProperties{
Command: []*string{
to.Ptr("/bin/sh"),
to.Ptr("-c"),
to.Ptr("sleep 10"),
},
Image: to.Ptr("alpine:latest"),
Resources: &armcontainerinstance.ResourceRequirements{
Requests: &armcontainerinstance.ResourceRequests{
CPU: to.Ptr[float64](1),
MemoryInGB: to.Ptr[float64](1),
},
},
},
},
},
OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
Priority: to.Ptr(armcontainerinstance.ContainerGroupPrioritySpot),
RestartPolicy: to.Ptr(armcontainerinstance.ContainerGroupRestartPolicyNever),
SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
},
}, 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 poll 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 = armcontainerinstance.ContainerGroupsClientCreateOrUpdateResponse{
// ContainerGroup: armcontainerinstance.ContainerGroup{
// Name: to.Ptr("demo1"),
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
// ID: to.Ptr("/subscriptions/subId/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
// Location: to.Ptr("eastus"),
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
// Containers: []*armcontainerinstance.Container{
// {
// Name: to.Ptr("test-container-001"),
// Properties: &armcontainerinstance.ContainerProperties{
// Command: []*string{
// to.Ptr("/bin/sh"),
// to.Ptr("-c"),
// to.Ptr("sleep 10"),
// },
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
// },
// Image: to.Ptr("alpine:latest"),
// Ports: []*armcontainerinstance.ContainerPort{
// },
// Resources: &armcontainerinstance.ResourceRequirements{
// Requests: &armcontainerinstance.ResourceRequests{
// CPU: to.Ptr[float64](1),
// MemoryInGB: to.Ptr[float64](1),
// },
// },
// },
// },
// },
// InitContainers: []*armcontainerinstance.InitContainerDefinition{
// },
// InstanceView: &armcontainerinstance.ContainerGroupPropertiesInstanceView{
// Events: []*armcontainerinstance.Event{
// },
// State: to.Ptr("Succeeded"),
// },
// IsCreatedFromStandbyPool: to.Ptr(false),
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// Priority: to.Ptr(armcontainerinstance.ContainerGroupPrioritySpot),
// ProvisioningState: to.Ptr("Succeeded"),
// RestartPolicy: to.Ptr(armcontainerinstance.ContainerGroupRestartPolicyNever),
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
// },
// },
// }
}
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 create or update container groups with specified configurations.
*
* @summary create or update container groups with specified configurations.
* x-ms-original-file: 2026-07-01/ContainerGroupsCreatePriority.json
*/
async function containerGroupsCreateWithPriority() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.createOrUpdate("demo", "demo1", {
location: "eastus",
containers: [
{
name: "test-container-001",
command: ["/bin/sh", "-c", "sleep 10"],
image: "alpine:latest",
resources: { requests: { cpu: 1, memoryInGB: 1 } },
},
],
osType: "Linux",
priority: "Spot",
restartPolicy: "Never",
sku: "Standard",
});
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
応答のサンプル
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subId/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "eastus",
"properties": {
"containers": [
{
"name": "test-container-001",
"properties": {
"command": [
"/bin/sh",
"-c",
"sleep 10"
],
"environmentVariables": [],
"image": "alpine:latest",
"ports": [],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1
}
}
}
}
],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Succeeded"
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"priority": "Spot",
"provisioningState": "Succeeded",
"restartPolicy": "Never",
"sku": "Standard"
}
}
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/subId/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "eastus",
"properties": {
"containers": [
{
"name": "test-container-001",
"properties": {
"command": [
"/bin/sh",
"-c",
"sleep 10"
],
"environmentVariables": [],
"image": "alpine:latest",
"ports": [],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1
}
}
}
}
],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Created"
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"priority": "Spot",
"provisioningState": "Created",
"restartPolicy": "Never",
"sku": "Standard"
}
}
ContainerGroupWithEncryptionProperties
要求のサンプル
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2026-07-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {}
}
},
"location": "eastus2",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"encryptionProperties": {
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
"keyName": "test-key",
"keyVersion": "<key version>",
"vaultBaseUrl": "https://testkeyvault.vault.azure.net"
},
"imageRegistryCredentials": [],
"ipAddress": {
"type": "Public",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"osType": "Linux"
}
}
import com.azure.resourcemanager.containerinstance.fluent.models.ContainerGroupInner;
import com.azure.resourcemanager.containerinstance.models.Container;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIdentity;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIdentityUserAssignedIdentities;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupIpAddressType;
import com.azure.resourcemanager.containerinstance.models.ContainerGroupNetworkProtocol;
import com.azure.resourcemanager.containerinstance.models.ContainerPort;
import com.azure.resourcemanager.containerinstance.models.EncryptionProperties;
import com.azure.resourcemanager.containerinstance.models.IpAddress;
import com.azure.resourcemanager.containerinstance.models.OperatingSystemTypes;
import com.azure.resourcemanager.containerinstance.models.Port;
import com.azure.resourcemanager.containerinstance.models.ResourceIdentityType;
import com.azure.resourcemanager.containerinstance.models.ResourceRequests;
import com.azure.resourcemanager.containerinstance.models.ResourceRequirements;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for ContainerGroups CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/ContainerGroupEncryptionProperties.json
*/
/**
* Sample code: ContainerGroupWithEncryptionProperties.
*
* @param manager Entry point to ContainerInstanceManager.
*/
public static void containerGroupWithEncryptionProperties(
com.azure.resourcemanager.containerinstance.ContainerInstanceManager manager) {
manager.serviceClient().getContainerGroups().createOrUpdate("demo", "demo1", new ContainerGroupInner()
.withLocation("eastus2")
.withIdentity(new ContainerGroupIdentity().withType(ResourceIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
new ContainerGroupIdentityUserAssignedIdentities())))
.withContainers(Arrays.asList(new Container().withName("demo1").withImage("nginx")
.withCommand(Arrays.asList()).withPorts(Arrays.asList(new ContainerPort().withPort(80)))
.withEnvironmentVariables(Arrays.asList()).withResources(
new ResourceRequirements().withRequests(new ResourceRequests().withMemoryInGB(1.5).withCpu(1.0)))))
.withImageRegistryCredentials(Arrays.asList())
.withIpAddress(new IpAddress()
.withPorts(Arrays.asList(new Port().withProtocol(ContainerGroupNetworkProtocol.TCP).withPort(80)))
.withType(ContainerGroupIpAddressType.PUBLIC))
.withOsType(OperatingSystemTypes.LINUX)
.withEncryptionProperties(new EncryptionProperties()
.withVaultBaseUrl("https://testkeyvault.vault.azure.net").withKeyName("fakeTokenPlaceholder")
.withKeyVersion("fakeTokenPlaceholder").withIdentity(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity")),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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_group_encryption_properties.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="SUBSCRIPTION_ID",
)
response = client.container_groups.begin_create_or_update(
resource_group_name="demo",
container_group_name="demo1",
container_group={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {}
},
},
"location": "eastus2",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [{"port": 80}],
"resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}},
},
}
],
"encryptionProperties": {
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
"keyName": "test-key",
"keyVersion": "<key version>",
"vaultBaseUrl": "https://testkeyvault.vault.azure.net",
},
"imageRegistryCredentials": [],
"ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Public"},
"osType": "Linux",
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/ContainerGroupEncryptionProperties.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v3"
)
// Generated from example definition: 2026-07-01/ContainerGroupEncryptionProperties.json
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupWithEncryptionProperties() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerinstance.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
Identity: &armcontainerinstance.ContainerGroupIdentity{
Type: to.Ptr(armcontainerinstance.ResourceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armcontainerinstance.UserAssignedIdentities{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {},
},
},
Location: to.Ptr("eastus2"),
Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
Containers: []*armcontainerinstance.Container{
{
Name: to.Ptr("demo1"),
Properties: &armcontainerinstance.ContainerProperties{
Command: []*string{},
EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{},
Image: to.Ptr("nginx"),
Ports: []*armcontainerinstance.ContainerPort{
{
Port: to.Ptr[int32](80),
},
},
Resources: &armcontainerinstance.ResourceRequirements{
Requests: &armcontainerinstance.ResourceRequests{
CPU: to.Ptr[float64](1),
MemoryInGB: to.Ptr[float64](1.5),
},
},
},
},
},
EncryptionProperties: &armcontainerinstance.EncryptionProperties{
Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity"),
KeyName: to.Ptr("test-key"),
KeyVersion: to.Ptr("<key version>"),
VaultBaseURL: to.Ptr("https://testkeyvault.vault.azure.net"),
},
ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{},
IPAddress: &armcontainerinstance.IPAddress{
Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
Ports: []*armcontainerinstance.Port{
{
Port: to.Ptr[int32](80),
Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
},
},
},
OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
},
}, 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 poll 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 = armcontainerinstance.ContainerGroupsClientCreateOrUpdateResponse{
// ContainerGroup: armcontainerinstance.ContainerGroup{
// Name: to.Ptr("demo1"),
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
// Identity: &armcontainerinstance.ContainerGroupIdentity{
// Type: to.Ptr(armcontainerinstance.ResourceIdentityTypeUserAssigned),
// TenantID: to.Ptr("<tenant id>"),
// UserAssignedIdentities: map[string]*armcontainerinstance.UserAssignedIdentities{
// "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": &armcontainerinstance.UserAssignedIdentities{
// ClientID: to.Ptr("<client id>"),
// PrincipalID: to.Ptr("<principal id>"),
// },
// },
// },
// Location: to.Ptr("eastus2"),
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
// Containers: []*armcontainerinstance.Container{
// {
// Name: to.Ptr("demo1"),
// Properties: &armcontainerinstance.ContainerProperties{
// Command: []*string{
// },
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
// },
// Image: to.Ptr("nginx"),
// Ports: []*armcontainerinstance.ContainerPort{
// {
// Port: to.Ptr[int32](80),
// },
// },
// Resources: &armcontainerinstance.ResourceRequirements{
// Requests: &armcontainerinstance.ResourceRequests{
// CPU: to.Ptr[float64](1),
// MemoryInGB: to.Ptr[float64](1.5),
// },
// },
// },
// },
// },
// EncryptionProperties: &armcontainerinstance.EncryptionProperties{
// Identity: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity"),
// KeyName: to.Ptr("test-key"),
// KeyVersion: to.Ptr("<key version>"),
// VaultBaseURL: to.Ptr("https://testkeyvault.vault.azure.net/"),
// },
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
// },
// InitContainers: []*armcontainerinstance.InitContainerDefinition{
// },
// InstanceView: &armcontainerinstance.ContainerGroupPropertiesInstanceView{
// Events: []*armcontainerinstance.Event{
// },
// State: to.Ptr("Pending"),
// },
// IPAddress: &armcontainerinstance.IPAddress{
// Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
// Ports: []*armcontainerinstance.Port{
// {
// Port: to.Ptr[int32](80),
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
// },
// },
// },
// IsCreatedFromStandbyPool: to.Ptr(false),
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Pending"),
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
// },
// },
// }
}
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 create or update container groups with specified configurations.
*
* @summary create or update container groups with specified configurations.
* x-ms-original-file: 2026-07-01/ContainerGroupEncryptionProperties.json
*/
async function containerGroupWithEncryptionProperties() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.createOrUpdate("demo", "demo1", {
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity":
{},
},
},
location: "eastus2",
containers: [
{
name: "demo1",
command: [],
environmentVariables: [],
image: "nginx",
ports: [{ port: 80 }],
resources: { requests: { cpu: 1, memoryInGB: 1.5 } },
},
],
encryptionProperties: {
identity:
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
keyName: "test-key",
keyVersion: "<key version>",
vaultBaseUrl: "https://testkeyvault.vault.azure.net",
},
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 80, protocol: "TCP" }] },
osType: "Linux",
});
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
応答のサンプル
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"identity": {
"type": "UserAssigned",
"tenantId": "<tenant id>",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {
"clientId": "<client id>",
"principalId": "<principal id>"
}
}
},
"location": "eastus2",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"encryptionProperties": {
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
"keyName": "test-key",
"keyVersion": "<key version>",
"vaultBaseUrl": "https://testkeyvault.vault.azure.net/"
},
"imageRegistryCredentials": [],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Pending"
},
"ipAddress": {
"type": "Public",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Pending",
"sku": "Standard"
}
}
{
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"identity": {
"type": "UserAssigned",
"tenantId": "<tenant id>",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {
"clientId": "<client id>",
"principalId": "<principal id>"
}
}
},
"location": "eastus2",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"encryptionProperties": {
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
"keyName": "test-key",
"keyVersion": "key version",
"vaultBaseUrl": "https://testkeyvault.vault.azure.net/"
},
"imageRegistryCredentials": [],
"initContainers": [],
"instanceView": {
"events": [],
"state": "Pending"
},
"ipAddress": {
"type": "Public",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
]
},
"isCreatedFromStandbyPool": false,
"osType": "Linux",
"provisioningState": "Running",
"sku": "Standard"
}
}
定義
AzureFileVolume
Object
Azure File ボリュームのプロパティ。 Azure ファイル共有はボリュームとしてマウントされます。
| Name |
型 |
説明 |
|
readOnly
|
boolean
|
ボリュームとしてマウントされた Azure File 共有が読み取り専用かどうかを示すフラグ。
|
|
shareName
|
string
|
ボリュームとしてマウントする Azure ファイル共有の名前。
|
|
storageAccountKey
|
string
(password)
|
Azure ファイル共有へのアクセスに使用されるストレージ アカウント アクセス キー。
|
|
storageAccountKeyReference
|
string
|
Azure ファイル共有へのアクセスに使用されるストレージ アカウント アクセス キーへの参照。
|
|
storageAccountName
|
string
|
Azure ファイル共有を含むストレージ アカウントの名前。
|
|
userManagedIdentityClientId
|
string
|
Azureファイル共有へのアクセスを持つユーザー割り当ての管理IDのクライアントID。
|
CloudError
Object
コンテナー インスタンス サービスからのエラー応答。
CloudErrorBody
Object
コンテナー インスタンス サービスからのエラー応答。
| Name |
型 |
説明 |
|
code
|
string
|
エラーの識別子。 コードは不変であり、プログラムで使用することを目的としています。
|
|
details
|
CloudErrorBody[]
|
エラーに関する追加の詳細のリスト。
|
|
message
|
string
|
ユーザー インターフェイスでの表示に適したエラーを説明するメッセージ。
|
|
target
|
string
|
特定のエラーのターゲット。 たとえば、エラーが発生したプロパティの名前です。
|
ConfidentialComputeProperties
Object
機密コンテナー グループのプロパティ
| Name |
型 |
説明 |
|
ccePolicy
|
string
|
base64 でエンコードされた機密コンピューティング適用ポリシー
|
ConfigMap
Object
コンテナー構成マップ。
| Name |
型 |
説明 |
|
keyValuePairs
|
object
|
キー値は、構成マップ内のディクショナリをペアにします。
|
Container
Object
コンテナー インスタンス。
ContainerExec
Object
コンテナー実行コマンド (ライブネスまたは準備プローブ用)
| Name |
型 |
説明 |
|
command
|
string[]
|
コンテナー内で実行するコマンド。
|
ContainerGroup
Object
コンテナー グループ。
ContainerGroupDiagnostics
Object
コンテナー グループの診断情報。
ContainerGroupIdentity
Object
コンテナー グループの ID。
| Name |
型 |
説明 |
|
principalId
|
string
|
コンテナー グループ ID のプリンシパル ID。 このプロパティは、システム割り当て ID にのみ提供されます。
|
|
tenantId
|
string
|
コンテナー グループに関連付けられているテナント ID。 このプロパティは、システム割り当て ID にのみ提供されます。
|
|
type
|
ResourceIdentityType
|
コンテナー グループに使用される ID の種類。 型 'SystemAssigned, UserAssigned' には、暗黙的に作成された ID とユーザー割り当て ID のセットの両方が含まれます。 型 'None' は、コンテナー グループからすべての ID を削除します。
|
|
userAssignedIdentities
|
<string,
UserAssignedIdentities>
|
コンテナー グループに関連付けられているユーザー ID の一覧。
|
ContainerGroupIpAddressType
列挙
IP がパブリック インターネットまたはプライベート VNET に公開されるかどうかを指定します。
| 値 |
説明 |
|
Public
|
Public
|
|
Private
|
Private
|
ContainerGroupNetworkProtocol
列挙
ポートに関連付けられているプロトコル。
| 値 |
説明 |
|
TCP
|
TCP
|
|
UDP
|
UDP(ユーザー・データグラム・プロトコル)
|
ContainerGroupPriority
列挙
コンテナー グループの優先順位。
| 値 |
説明 |
|
Regular
|
レギュラー
|
|
Spot
|
点
|
ContainerGroupProfileReferenceDefinition
Object
コンテナー グループ プロファイル参照。
| Name |
型 |
説明 |
|
id
|
string
(arm-id)
|
コンテナー グループ プロファイル参照 ID。これは、'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}' という形式の ARM リソース ID になります。
|
|
revision
|
integer
(int32)
|
コンテナー グループ プロファイル参照リビジョン。
|
ContainerGroupPropertiesPropertiesInstanceView
Object
コンテナー グループのインスタンス ビュー。 応答でのみ有効です。
| Name |
型 |
説明 |
|
events
|
Event[]
|
このコンテナー グループのイベント。
|
|
state
|
string
|
コンテナー グループの状態。 応答でのみ有効です。
|
ContainerGroupRestartPolicy
列挙
コンテナー グループ内のすべてのコンテナーのポリシーを再起動します。
-
Always 常に再起動する
-
OnFailure 失敗した場合の再起動
-
Never 再起動しない
| 値 |
説明 |
|
Always
|
いつも
|
|
OnFailure
|
OnFailure
|
|
Never
|
決してない
|
ContainerGroupSku
列挙
コンテナー グループ SKU。
| 値 |
説明 |
|
NotSpecified
|
指定なし
|
|
Standard
|
Standard
|
|
Dedicated
|
Dedicated
|
|
Confidential
|
機密
|
ContainerGroupSubnetId
Object
コンテナー グループのサブネット情報。
| Name |
型 |
説明 |
|
id
|
string
|
仮想ネットワークとサブネットのリソース ID。
|
|
name
|
string
|
サブネットのフレンドリ名。
|
ContainerHttpGet
Object
コンテナー Http Get の設定 (ライブネスプローブまたは準備プローブ用)
| Name |
型 |
説明 |
|
httpHeaders
|
HttpHeader[]
|
HTTP ヘッダー。
|
|
path
|
string
|
プローブするパス。
|
|
port
|
integer
(int32)
|
プローブするポート番号。
|
|
scheme
|
Scheme
|
スキーム。
|
ContainerNetworkProtocol
列挙
ポートに関連付けられているプロトコル。
| 値 |
説明 |
|
TCP
|
TCP
|
|
UDP
|
UDP(ユーザー・データグラム・プロトコル)
|
ContainerPort
Object
コンテナー インスタンスで公開されているポート。
ContainerProbe
Object
コンテナー プローブ (ライブ性または準備のため)
| Name |
型 |
説明 |
|
exec
|
ContainerExec
|
プローブする実行コマンド
|
|
failureThreshold
|
integer
(int32)
|
エラーのしきい値。
|
|
httpGet
|
ContainerHttpGet
|
プローブする Http Get 設定
|
|
initialDelaySeconds
|
integer
(int32)
|
最初の遅延秒数。
|
|
periodSeconds
|
integer
(int32)
|
期間 (秒)。
|
|
successThreshold
|
integer
(int32)
|
成功のしきい値。
|
|
timeoutSeconds
|
integer
(int32)
|
タイムアウト秒数。
|
ContainerPropertiesInstanceView
Object
コンテナー インスタンスのインスタンス ビュー。 応答でのみ有効です。
| Name |
型 |
説明 |
|
currentState
|
ContainerState
|
現在のコンテナー インスタンスの状態。
|
|
events
|
Event[]
|
コンテナー インスタンスのイベント。
|
|
previousState
|
ContainerState
|
以前のコンテナー インスタンスの状態。
|
|
restartCount
|
integer
(int32)
|
コンテナー インスタンスが再起動された回数。
|
ContainerState
Object
コンテナー インスタンスの状態。
| Name |
型 |
説明 |
|
detailStatus
|
string
|
コンテナー インスタンスの状態の人間が判読できる状態。
|
|
exitCode
|
integer
(int32)
|
コンテナー インスタンスの終了コードは、docker run コマンドの終了コードに対応します。
|
|
finishTime
|
string
(date-time)
|
コンテナー インスタンスの状態が終了した日時。
|
|
startTime
|
string
(date-time)
|
コンテナー インスタンスの状態が開始された日時。
|
|
state
|
string
|
コンテナー インスタンスの状態。
|
createdByType
列挙
リソースを作成した ID の種類。
| 値 |
説明 |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
DeploymentExtensionSpec
Object
展開に追加する拡張サイドカー。
| Name |
型 |
説明 |
|
name
|
string
|
拡張機能の名前。
|
|
properties.extensionType
|
string
|
追加する拡張機能の種類。
|
|
properties.protectedSettings
|
|
拡張機能の保護された設定。
|
|
properties.settings
|
|
拡張機能の設定。
|
|
properties.version
|
string
|
使用されている拡張機能のバージョン。
|
DnsConfiguration
Object
コンテナー グループの DNS 構成。
| Name |
型 |
説明 |
|
nameServers
|
string[]
|
コンテナー グループの DNS サーバー。
|
|
options
|
string
|
コンテナー グループの DNS オプション。
|
|
searchDomains
|
string
|
コンテナー グループ内のホスト名検索の DNS 検索ドメイン。
|
DnsNameLabelReusePolicy
列挙
セキュリティ列挙型を表す値。 'Unsecure' 値は、選択されていない場合の既定値であり、オブジェクトのドメイン名ラベルがサブドメインの引き継ぎに対してセキュリティで保護されていないことを意味します。 [TenantReuse] の値が選択されている場合は既定値であり、オブジェクトのドメイン名ラベルを同じテナント内で再利用できることを意味します。 "SubscriptionReuse" 値は、オブジェクトのドメイン名ラベルを同じサブスクリプション内で再利用できることを意味します。 'ResourceGroupReuse' 値は、オブジェクトのドメイン名ラベルを同じリソース グループ内で再利用できることを意味します。 'NoReuse' 値は、オブジェクトのドメイン名ラベルを同じリソース グループ、サブスクリプション、またはテナント内で再利用できないことを意味します。
| 値 |
説明 |
|
Unsecure
|
セキュリティで保護されていない
|
|
TenantReuse
|
TenantReuse
|
|
SubscriptionReuse
|
SubscriptionReuse
|
|
ResourceGroupReuse
|
ResourceGroupReuse
|
|
Noreuse
|
Noreuse
|
EncryptionProperties
Object
コンテナー グループの暗号化プロパティ。
| Name |
型 |
説明 |
|
identity
|
string
|
keyvault マネージド ID。
|
|
keyName
|
string
|
暗号化キーの名前。
|
|
keyVersion
|
string
|
暗号化キーのバージョン。
|
|
vaultBaseUrl
|
string
|
keyvault のベース URL。
|
EnvironmentVariable
Object
コンテナー インスタンス内で設定する環境変数。
| Name |
型 |
説明 |
|
name
|
string
|
環境変数の名前。
|
|
secureValue
|
string
(password)
|
セキュリティで保護された環境変数の値。
|
|
secureValueReference
|
string
|
セキュリティで保護された環境変数の参照。
|
|
value
|
string
|
環境変数の値。
|
Event
Object
コンテナー グループまたはコンテナー インスタンス イベント。
| Name |
型 |
説明 |
|
count
|
integer
(int32)
|
イベントの数。
|
|
firstTimestamp
|
string
(date-time)
|
ログに記録された最も古いイベントの日時。
|
|
lastTimestamp
|
string
(date-time)
|
ログに記録された最新のイベントの日時。
|
|
message
|
string
|
イベント メッセージ。
|
|
name
|
string
|
イベント名。
|
|
type
|
string
|
イベントの種類。
|
GitRepoVolume
Object
Git リポジトリの内容が設定されたボリュームを表します。
| Name |
型 |
説明 |
|
directory
|
string
|
ターゲット ディレクトリ名。 '..' を含めたり、先頭に含めたりすることはできません。 '.' が指定されている場合、ボリューム ディレクトリは Git リポジトリになります。 指定しない場合、ボリュームには、指定された名前の git リポジトリがサブディレクトリに含まれます。
|
|
repository
|
string
|
リポジトリ URL
|
|
revision
|
string
|
指定したリビジョンのコミット ハッシュ。
|
GpuResource
Object
GPU リソース。
| Name |
型 |
説明 |
|
count
|
integer
(int32)
|
GPU リソースの数。
|
|
sku
|
GpuSku
|
GPU リソースの SKU。
|
GpuSku
列挙
GPU リソースの SKU。
| 値 |
説明 |
|
K80
|
K80
|
|
P100
|
P100
|
|
V100
|
V100
|
Object
HTTP ヘッダー。
| Name |
型 |
説明 |
|
name
|
string
|
ヘッダー名。
|
|
value
|
string
|
ヘッダー値。
|
IdentityAccessControl
Object
ID のアクセス制御
IdentityAccessLevel
列挙
ID のアクセス レベル。
| 値 |
説明 |
|
All
|
All
|
|
System
|
System
|
|
User
|
User
|
IdentityAcls
Object
ID のアクセス制御レベル。
ImageRegistryCredential
Object
イメージ レジストリの資格情報。
| Name |
型 |
説明 |
|
identity
|
string
|
プライベート レジストリの ID。
|
|
identityUrl
|
string
|
プライベート レジストリの ID URL。
|
|
password
|
string
(password)
|
プライベート レジストリのパスワード。
|
|
passwordReference
|
string
|
プライベート レジストリ パスワードのリファレンス。
|
|
server
|
string
|
"http" や "https" などのプロトコルのない Docker イメージ レジストリ サーバー。
|
|
username
|
string
|
プライベート レジストリのユーザー名。
|
InitContainerDefinition
Object
init コンテナー定義。
InitContainerPropertiesDefinitionInstanceView
Object
init コンテナーのインスタンス ビュー。 応答でのみ有効です。
| Name |
型 |
説明 |
|
currentState
|
ContainerState
|
init コンテナーの現在の状態。
|
|
events
|
Event[]
|
init コンテナーのイベント。
|
|
previousState
|
ContainerState
|
init コンテナーの以前の状態。
|
|
restartCount
|
integer
(int32)
|
init コンテナーが再起動された回数。
|
IpAddress
Object
コンテナー グループの IP アドレス。
| Name |
型 |
規定値 |
説明 |
|
autoGeneratedDomainNameLabelScope
|
DnsNameLabelReusePolicy
|
Unsecure
|
セキュリティ列挙型を表す値。 'Unsecure' 値は、選択されていない場合の既定値であり、オブジェクトのドメイン名ラベルがサブドメインの引き継ぎに対してセキュリティで保護されていないことを意味します。 [TenantReuse] の値が選択されている場合は既定値であり、オブジェクトのドメイン名ラベルを同じテナント内で再利用できることを意味します。 "SubscriptionReuse" 値は、オブジェクトのドメイン名ラベルを同じサブスクリプション内で再利用できることを意味します。 'ResourceGroupReuse' 値は、オブジェクトのドメイン名ラベルを同じリソース グループ内で再利用できることを意味します。 'NoReuse' 値は、オブジェクトのドメイン名ラベルを同じリソース グループ、サブスクリプション、またはテナント内で再利用できないことを意味します。
|
|
dnsNameLabel
|
string
|
|
IP の Dns 名ラベル。
|
|
fqdn
|
string
|
|
IP の FQDN。
|
|
ip
|
string
|
|
パブリック インターネットに公開されている IP。
|
|
ports
|
Port[]
|
|
コンテナー グループで公開されているポートの一覧。
|
|
type
|
ContainerGroupIpAddressType
|
|
IP がパブリック インターネットまたはプライベート VNET に公開されるかどうかを指定します。
|
LogAnalytics
Object
コンテナー グループのログ分析情報。
| Name |
型 |
説明 |
|
logType
|
LogAnalyticsLogType
|
使用するログの種類。
|
|
metadata
|
object
|
ログ分析のメタデータ。
|
|
workspaceId
|
string
|
ログ分析のワークスペース ID
|
|
workspaceKey
|
string
(password)
|
ログ分析のワークスペース キー
|
|
workspaceResourceId
|
string
(password)
|
ログ分析のワークスペース リソース ID
|
LogAnalyticsLogType
列挙
使用するログの種類。
| 値 |
説明 |
|
ContainerInsights
|
ContainerInsights
|
|
ContainerInstanceLogs
|
ContainerInstanceLogs
|
OperatingSystemTypes
列挙
コンテナー グループ内のコンテナーに必要なオペレーティング システムの種類。
| 値 |
説明 |
|
Windows
|
Windows
|
|
Linux
|
Linux
|
Port
Object
コンテナー グループで公開されているポート。
ResourceIdentityType
列挙
コンテナー グループに使用される ID の種類。 型 'SystemAssigned, UserAssigned' には、暗黙的に作成された ID とユーザー割り当て ID のセットの両方が含まれます。 型 'None' は、コンテナー グループからすべての ID を削除します。
| 値 |
説明 |
|
SystemAssigned
|
SystemAssigned
|
|
UserAssigned
|
UserAssigned
|
|
SystemAssigned, UserAssigned
|
システム割り当て済み、ユーザー割り当て済み
|
|
None
|
なし
|
ResourceLimits
Object
リソースの制限。
| Name |
型 |
説明 |
|
cpu
|
number
(double)
|
このコンテナー インスタンスの CPU 制限。
|
|
gpu
|
GpuResource
|
このコンテナー インスタンスの GPU 制限。
|
|
memoryInGB
|
number
(double)
|
このコンテナー インスタンスのメモリ制限 (GB 単位)。
|
ResourceRequests
Object
リソース要求。
| Name |
型 |
説明 |
|
cpu
|
number
(double)
|
このコンテナー インスタンスの CPU 要求。
|
|
gpu
|
GpuResource
|
このコンテナー インスタンスの GPU 要求。
|
|
memoryInGB
|
number
(double)
|
このコンテナー インスタンスのメモリ要求 (GB 単位)。
|
ResourceRequirements
Object
リソースの要件。
Scheme
列挙
スキーム。
| 値 |
説明 |
|
http
|
http
|
|
https
|
https
|
SecretReference
Object
シークレット参照
| Name |
型 |
説明 |
|
identity
|
string
(arm-id)
|
キー コンテナー内のシークレットにアクセスできるマネージド ID の ARM リソース ID
|
|
name
|
string
|
シークレット参照の識別子
|
|
secretReferenceUri
|
string
(uri)
|
キー コンテナー内のシークレットへの URI
|
SecurityContextCapabilitiesDefinition
Object
コンテナーに追加または削除する機能。
| Name |
型 |
説明 |
|
add
|
string[]
|
コンテナーに追加する機能。
|
|
drop
|
string[]
|
コンテナーから削除する機能。
|
SecurityContextDefinition
Object
コンテナーのセキュリティ コンテキスト。
| Name |
型 |
説明 |
|
allowPrivilegeEscalation
|
boolean
|
init プロセスがその特権を昇格できるかどうかを示すブール値
|
|
capabilities
|
SecurityContextCapabilitiesDefinition
|
コンテナーに追加または削除する機能。
|
|
privileged
|
boolean
|
コンテナーのアクセス許可が Privileged に昇格されているかどうかを判断するフラグ。
|
|
runAsGroup
|
integer
(int32)
|
コンテナーのユーザー GID を設定します。
|
|
runAsUser
|
integer
(int32)
|
コンテナーのユーザー UID を設定します。
|
|
seccompProfile
|
string
|
seccomp プロファイル内の JSON の内容を含む base64 でエンコードされた文字列
|
StandbyPoolProfileDefinition
Object
スタンバイ プール プロファイル参照。
| Name |
型 |
説明 |
|
failContainerGroupCreateOnReuseFailure
|
boolean
|
コンテナー グループをスタンバイ プールから取得できない場合に ACI が作成要求に失敗するかどうかを判断するフラグ。
|
|
id
|
string
(arm-id)
|
スタンバイ プール プロファイル参照 ID。これは、'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyPoolName}' という形式の ARM リソース ID になります。
|
systemData
Object
リソースの作成と最後の変更に関連するメタデータ。
| Name |
型 |
説明 |
|
createdAt
|
string
(date-time)
|
リソース作成のタイムスタンプ (UTC)。
|
|
createdBy
|
string
|
リソースを作成した ID。
|
|
createdByType
|
createdByType
|
リソースを作成した ID の種類。
|
|
lastModifiedAt
|
string
(date-time)
|
リソースの最終変更のタイムスタンプ (UTC)
|
|
lastModifiedBy
|
string
|
リソースを最後に変更した ID。
|
|
lastModifiedByType
|
createdByType
|
リソースを最後に変更した ID の種類。
|
UserAssignedIdentities
Object
コンテナー グループに関連付けられているユーザー ID の一覧。 ユーザー ID ディクショナリ のキー参照は、'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}' という形式の ARM リソース ID になります。
| Name |
型 |
説明 |
|
clientId
|
string
|
ユーザー割り当て ID のクライアント ID。
|
|
principalId
|
string
|
ユーザー割り当て ID のプリンシパル ID。
|
Volume
Object
ボリュームのプロパティ。
| Name |
型 |
説明 |
|
azureFile
|
AzureFileVolume
|
Azure File ボリューム。
|
|
emptyDir
|
|
空のディレクトリ ボリューム。
|
|
gitRepo
|
GitRepoVolume
|
Git リポジトリ ボリューム。
|
|
name
|
string
|
ボリュームの名前。
|
|
secret
|
object
|
秘密ボリュームのファイルを定義します。 辞書キーはファイル名、値はBase64でエンコードされた秘密データで、ファイル内容として使われます。 値はセンシティブであり、サービスはこのプロパティの内容をGET応答で返しません。
|
|
secretReference
|
object
|
秘密参照ボリュームのファイルを定義します。 辞書キーはファイル名であり、値はコンテナグループのsecretReferencesコレクション内のエントリを識別します。 このプロパティは秘密値ではなく参照名を含みます。
|
VolumeMount
Object
ボリューム マウントのプロパティ。
| Name |
型 |
説明 |
|
mountPath
|
string
|
ボリュームをマウントするコンテナー内のパス。 コロン (:)を含めてはなりません。
|
|
name
|
string
|
ボリューム マウントの名前。
|
|
readOnly
|
boolean
|
ボリューム マウントが読み取り専用かどうかを示すフラグ。
|