Creare o aggiornare gruppi di contenitori con configurazioni specificate.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}?api-version=2023-05-01
Parametri dell'URI
Nome |
In |
Necessario |
Tipo |
Descrizione |
containerGroupName
|
path |
True
|
string
|
Nome del gruppo di contenitori.
|
resourceGroupName
|
path |
True
|
string
|
Nome del gruppo di risorse.
|
subscriptionId
|
path |
True
|
string
|
Credenziali di sottoscrizione che identificano in modo univoco la sottoscrizione di Microsoft Azure. L'ID sottoscrizione fa parte dell'URI per ogni chiamata al servizio.
|
api-version
|
query |
True
|
string
|
Versione dell'API client
|
Corpo della richiesta
Nome |
Necessario |
Tipo |
Descrizione |
properties.containers
|
True
|
Container[]
|
Contenitori all'interno del gruppo di contenitori.
|
properties.osType
|
True
|
OperatingSystemTypes
|
Tipo di sistema operativo richiesto dai contenitori nel gruppo di contenitori.
|
identity
|
|
ContainerGroupIdentity
|
Identità del gruppo di contenitori, se configurata.
|
location
|
|
string
|
Percorso della risorsa.
|
properties.confidentialComputeProperties
|
|
ConfidentialComputeProperties
|
Proprietà per il gruppo di contenitori riservati
|
properties.diagnostics
|
|
ContainerGroupDiagnostics
|
Informazioni di diagnostica per un gruppo di contenitori.
|
properties.dnsConfig
|
|
DnsConfiguration
|
Informazioni di configurazione DNS per un gruppo di contenitori.
|
properties.encryptionProperties
|
|
EncryptionProperties
|
Proprietà di crittografia per un gruppo di contenitori.
|
properties.extensions
|
|
DeploymentExtensionSpec[]
|
estensioni usate da kubelet virtuale
|
properties.imageRegistryCredentials
|
|
ImageRegistryCredential[]
|
Credenziali del Registro immagini da cui viene creato il gruppo di contenitori.
|
properties.initContainers
|
|
InitContainerDefinition[]
|
Contenitori init per un gruppo di contenitori.
|
properties.ipAddress
|
|
IpAddress
|
Tipo di indirizzo IP del gruppo di contenitori.
|
properties.priority
|
|
ContainerGroupPriority
|
Priorità del gruppo di contenitori.
|
properties.restartPolicy
|
|
ContainerGroupRestartPolicy
|
Criteri di riavvio per tutti i contenitori all'interno del gruppo di contenitori.
-
Always Riavviare sempre
-
OnFailure Riavvio in caso di errore
-
Never Non riavviare mai
|
properties.sku
|
|
ContainerGroupSku
|
SKU per un gruppo di contenitori.
|
properties.subnetIds
|
|
ContainerGroupSubnetId[]
|
ID risorsa subnet per un gruppo di contenitori.
|
properties.volumes
|
|
Volume[]
|
Elenco di volumi che possono essere montati da contenitori in questo gruppo di contenitori.
|
tags
|
|
object
|
Tag di risorsa.
|
zones
|
|
string[]
|
Zone per il gruppo di contenitori.
|
Risposte
Nome |
Tipo |
Descrizione |
200 OK
|
ContainerGroup
|
Va bene
|
201 Created
|
ContainerGroup
|
Creato: viene creato il gruppo di contenitori.
|
Other Status Codes
|
CloudError
|
Risposta di errore che descrive il motivo per cui l'operazione non è riuscita.
|
Sicurezza
azure_auth
Flusso OAuth2 di Azure Active Directory
Tipo:
oauth2
Flow:
implicit
URL di autorizzazione:
https://login.microsoftonline.com/common/oauth2/authorize
Ambiti
Nome |
Descrizione |
user_impersonation
|
Rappresentare l'account utente
|
Esempio
ConfidentialContainerGroup
Esempio di richiesta
PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01
{
"location": "westeurope",
"properties": {
"containers": [
{
"name": "accdemo",
"properties": {
"command": [],
"environmentVariables": [],
"image": "confiimage",
"ports": [
{
"port": 8000
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
},
"securityContext": {
"privileged": false,
"capabilities": {
"add": [
"CAP_NET_ADMIN"
]
}
}
}
}
],
"imageRegistryCredentials": [],
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 8000
}
],
"type": "Public"
},
"osType": "Linux",
"sku": "Confidential",
"confidentialComputeProperties": {
"ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
}
}
}
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:
* specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/
* ContainerGroupCreateConfidential.json
*/
/**
* Sample code: ConfidentialContainerGroup.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void confidentialContainerGroup(com.azure.resourcemanager.AzureResourceManager azure) {
azure.containerGroups().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="subid",
)
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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
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),
},
Location: to.Ptr("westeurope"),
}, 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 pull 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.ContainerGroup = armcontainerinstance.ContainerGroup{
// 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),
// }},
// },
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUConfidential),
// },
// 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"),
// }
}
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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupCreateConfidential.json
*/
async function confidentialContainerGroup() {
const subscriptionId = process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
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" }] },
location: "westeurope",
osType: "Linux",
sku: "Confidential",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ContainerInstance.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.ContainerInstance;
// Generated from example definition: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupCreateConfidential.json
// this example is just showing the usage of "ContainerGroups_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "demo";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this ContainerGroupResource
ContainerGroupCollection collection = resourceGroupResource.GetContainerGroups();
// invoke the operation
string containerGroupName = "demo1";
ContainerGroupData data = new ContainerGroupData(new AzureLocation("westeurope"), new ContainerInstanceContainer[]
{
new ContainerInstanceContainer("accdemo","confiimage",new ContainerResourceRequirements(new ContainerResourceRequestsContent(1.5,1)))
{
Command =
{
},
Ports =
{
new ContainerPort(8000)
},
EnvironmentVariables =
{
},
SecurityContext = new ContainerSecurityContextDefinition()
{
IsPrivileged = false,
Capabilities = new ContainerSecurityContextCapabilitiesDefinition()
{
Add =
{
"CAP_NET_ADMIN"
},
},
},
}
}, ContainerInstanceOperatingSystemType.Linux)
{
ImageRegistryCredentials =
{
},
IPAddress = new ContainerGroupIPAddress(new ContainerGroupPort[]
{
new ContainerGroupPort(8000)
{
Protocol = ContainerGroupNetworkProtocol.Tcp,
}
}, ContainerGroupIPAddressType.Public),
Sku = ContainerGroupSku.Confidential,
ConfidentialComputeCcePolicy = "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19",
};
ArmOperation<ContainerGroupResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerGroupName, data);
ContainerGroupResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ContainerGroupData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
{
"properties": {
"sku": "Confidential",
"provisioningState": "Succeeded",
"containers": [
{
"name": "accdemo",
"properties": {
"image": "confiimage",
"command": [],
"ports": [
{
"port": 8000
}
],
"environmentVariables": [],
"resources": {
"requests": {
"memoryInGB": 1.5,
"cpu": 1
}
},
"securityContext": {
"privileged": false,
"capabilities": {
"add": [
"CAP_NET_ADMIN"
]
}
}
}
}
],
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 8000
}
],
"type": "Public"
},
"initContainers": [],
"imageRegistryCredentials": [],
"osType": "Linux",
"instanceView": {
"events": [],
"state": "Running"
},
"confidentialComputeProperties": {
"ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
}
},
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"location": "westeurope"
}
{
"properties": {
"sku": "Confidential",
"provisioningState": "Succeeded",
"containers": [
{
"name": "accdemo",
"properties": {
"image": "confiimage",
"command": [],
"ports": [
{
"port": 8000
}
],
"environmentVariables": [],
"resources": {
"requests": {
"memoryInGB": 1.5,
"cpu": 1
}
},
"securityContext": {
"privileged": false,
"capabilities": {
"add": [
"CAP_NET_ADMIN"
]
}
}
}
}
],
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 8000
}
],
"type": "Public"
},
"initContainers": [],
"imageRegistryCredentials": [],
"osType": "Linux",
"instanceView": {
"events": [],
"state": "Running"
},
"confidentialComputeProperties": {
"ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
}
},
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"location": "westeurope"
}
ContainerGroupCreateWithExtensions
Esempio di richiesta
PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01
{
"location": "eastus2",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"imageRegistryCredentials": [],
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"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"
}
],
"extensions": [
{
"name": "kube-proxy",
"properties": {
"extensionType": "kube-proxy",
"version": "1.0",
"settings": {
"clusterCidr": "10.240.0.0/16",
"kubeVersion": "v1.9.10"
},
"protectedSettings": {
"kubeConfig": "<kubeconfig encoded string>"
}
}
},
{
"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:
* specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/
* ContainerGroupExtensions.json
*/
/**
* Sample code: ContainerGroupCreateWithExtensions.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void containerGroupCreateWithExtensions(com.azure.resourcemanager.AzureResourceManager azure)
throws IOException {
azure.containerGroups().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="subid",
)
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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
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"),
},
}},
},
Location: to.Ptr("eastus2"),
}, 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 pull 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.ContainerGroup = armcontainerinstance.ContainerGroup{
// 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"),
// },
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// 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"),
// },
// }},
// },
// 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"),
// }
}
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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupExtensions.json
*/
async function containerGroupCreateWithExtensions() {
const subscriptionId = process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
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" }] },
location: "eastus2",
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",
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ContainerInstance.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.ContainerInstance;
// Generated from example definition: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupExtensions.json
// this example is just showing the usage of "ContainerGroups_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "demo";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this ContainerGroupResource
ContainerGroupCollection collection = resourceGroupResource.GetContainerGroups();
// invoke the operation
string containerGroupName = "demo1";
ContainerGroupData data = new ContainerGroupData(new AzureLocation("eastus2"), new ContainerInstanceContainer[]
{
new ContainerInstanceContainer("demo1","nginx",new ContainerResourceRequirements(new ContainerResourceRequestsContent(1.5,1)))
{
Command =
{
},
Ports =
{
new ContainerPort(80)
},
EnvironmentVariables =
{
},
}
}, ContainerInstanceOperatingSystemType.Linux)
{
ImageRegistryCredentials =
{
},
IPAddress = new ContainerGroupIPAddress(new ContainerGroupPort[]
{
new ContainerGroupPort(80)
{
Protocol = ContainerGroupNetworkProtocol.Tcp,
}
}, ContainerGroupIPAddressType.Private),
SubnetIds =
{
new ContainerGroupSubnetId(new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"))
},
Extensions =
{
new DeploymentExtensionSpec("kube-proxy")
{
ExtensionType = "kube-proxy",
Version = "1.0",
Settings = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["clusterCidr"] = "10.240.0.0/16",
["kubeVersion"] = "v1.9.10"}),
ProtectedSettings = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["kubeConfig"] = "<kubeconfig encoded string>"}),
},new DeploymentExtensionSpec("vk-realtime-metrics")
{
ExtensionType = "realtime-metrics",
Version = "1.0",
}
},
};
ArmOperation<ContainerGroupResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerGroupName, data);
ContainerGroupResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ContainerGroupData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
{
"properties": {
"sku": "Standard",
"provisioningState": "Pending",
"containers": [
{
"name": "demo1",
"properties": {
"image": "nginx",
"command": [],
"ports": [
{
"port": 80
}
],
"environmentVariables": [],
"resources": {
"requests": {
"memoryInGB": 1.5,
"cpu": 1
}
}
}
}
],
"initContainers": [],
"extensions": [
{
"name": "kube-proxy",
"properties": {
"extensionType": "kube-proxy",
"version": "1.0",
"settings": {
"clusterCidr": "10.240.0.0/16",
"kubeVersion": "v1.9.10"
}
}
},
{
"name": "vk-realtime-metrics",
"properties": {
"extensionType": "realtime-metrics",
"version": "1.0"
}
}
],
"imageRegistryCredentials": [],
"osType": "Linux",
"instanceView": {
"events": [],
"state": "Pending"
},
"subnetIds": [
{
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
}
]
},
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"location": "eastus2"
}
{
"properties": {
"sku": "Standard",
"provisioningState": "Pending",
"containers": [
{
"name": "demo1",
"properties": {
"image": "nginx",
"command": [],
"ports": [
{
"port": 80
}
],
"environmentVariables": [],
"resources": {
"requests": {
"memoryInGB": 1.5,
"cpu": 1
}
}
}
}
],
"initContainers": [],
"extensions": [
{
"name": "kube-proxy",
"properties": {
"extensionType": "kube-proxy",
"version": "1.0",
"settings": {
"clusterCidr": "10.240.0.0/16",
"kubeVersion": "v1.9.10"
}
}
},
{
"name": "vk-realtime-metrics",
"properties": {
"extensionType": "realtime-metrics",
"version": "1.0"
}
}
],
"imageRegistryCredentials": [],
"osType": "Linux",
"instanceView": {
"events": [],
"state": "Running"
},
"subnetIds": [
{
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
}
]
},
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"location": "eastus2"
}
ContainerGroupsCreateOrUpdate
Esempio di richiesta
PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01
{
"location": "west us",
"identity": {
"type": "SystemAssigned, UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}
}
},
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5,
"gpu": {
"count": 1,
"sku": "K80"
}
}
},
"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",
"workspaceKey": "workspaceKey",
"logType": "ContainerInsights",
"metadata": {
"test-key": "test-metadata-value"
},
"workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"
}
},
"subnetIds": [
{
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
}
],
"dnsConfig": {
"nameServers": [
"1.1.1.1"
],
"searchDomains": "cluster.local svc.cluster.local",
"options": "ndots:2"
},
"imageRegistryCredentials": [],
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"type": "Public",
"dnsNameLabel": "dnsnamelabel1",
"autoGeneratedDomainNameLabelScope": "Unsecure"
},
"osType": "Linux",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName",
"storageAccountKey": "accountKey"
}
},
{
"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:
* specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/
* ContainerGroupsCreateOrUpdate.json
*/
/**
* Sample code: ContainerGroupsCreateOrUpdate.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void containerGroupsCreateOrUpdate(com.azure.resourcemanager.AzureResourceManager azure)
throws IOException {
azure.containerGroups().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="subid",
)
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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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("<subscription-id>", 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": {},
},
},
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"),
},
}},
},
Location: to.Ptr("west us"),
}, 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 pull 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.ContainerGroup = armcontainerinstance.ContainerGroup{
// 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),
// }},
// },
// 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{
// },
// }},
// },
// 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"),
// 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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsCreateOrUpdate.json
*/
async function containerGroupsCreateOrUpdate() {
const subscriptionId = process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
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: { testKey: "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",
},
identity: {
type: "SystemAssigned, UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000000000000000000000000000/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identityName":
{},
},
},
imageRegistryCredentials: [],
ipAddress: {
type: "Public",
autoGeneratedDomainNameLabelScope: "Unsecure",
dnsNameLabel: "dnsnamelabel1",
ports: [{ port: 80, protocol: "TCP" }],
},
location: "west us",
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",
},
},
],
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ContainerInstance.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.ContainerInstance;
// Generated from example definition: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsCreateOrUpdate.json
// this example is just showing the usage of "ContainerGroups_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "demo";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this ContainerGroupResource
ContainerGroupCollection collection = resourceGroupResource.GetContainerGroups();
// invoke the operation
string containerGroupName = "demo1";
ContainerGroupData data = new ContainerGroupData(new AzureLocation("west us"), new ContainerInstanceContainer[]
{
new ContainerInstanceContainer("demo1","nginx",new ContainerResourceRequirements(new ContainerResourceRequestsContent(1.5,1)
{
Gpu = new ContainerGpuResourceInfo(1,ContainerGpuSku.K80),
}))
{
Command =
{
},
Ports =
{
new ContainerPort(80)
},
EnvironmentVariables =
{
},
VolumeMounts =
{
new ContainerVolumeMount("volume1","/mnt/volume1")
{
IsReadOnly = false,
},new ContainerVolumeMount("volume2","/mnt/volume2")
{
IsReadOnly = false,
},new ContainerVolumeMount("volume3","/mnt/volume3")
{
IsReadOnly = true,
}
},
}
}, ContainerInstanceOperatingSystemType.Linux)
{
Identity = new ManagedServiceIdentity("SystemAssigned, UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name")] = new UserAssignedIdentity(),
},
},
ImageRegistryCredentials =
{
},
IPAddress = new ContainerGroupIPAddress(new ContainerGroupPort[]
{
new ContainerGroupPort(80)
{
Protocol = ContainerGroupNetworkProtocol.Tcp,
}
}, ContainerGroupIPAddressType.Public)
{
DnsNameLabel = "dnsnamelabel1",
AutoGeneratedDomainNameLabelScope = DnsNameLabelReusePolicy.Unsecure,
},
Volumes =
{
new ContainerVolume("volume1")
{
AzureFile = new ContainerInstanceAzureFileVolume("shareName","accountName")
{
StorageAccountKey = "accountKey",
},
},new ContainerVolume("volume2")
{
EmptyDir = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
}),
},new ContainerVolume("volume3")
{
Secret =
{
["secretKey1"] = "SecretValue1InBase64",
["secretKey2"] = "SecretValue2InBase64",
},
}
},
DiagnosticsLogAnalytics = new ContainerGroupLogAnalytics("workspaceid", "workspaceKey")
{
LogType = ContainerGroupLogAnalyticsLogType.ContainerInsights,
Metadata =
{
["test-key"] = "test-metadata-value",
},
WorkspaceResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"),
},
SubnetIds =
{
new ContainerGroupSubnetId(new ResourceIdentifier("[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"))
},
DnsConfig = new ContainerGroupDnsConfiguration(new string[]
{
"1.1.1.1"
})
{
SearchDomains = "cluster.local svc.cluster.local",
Options = "ndots:2",
},
};
ArmOperation<ContainerGroupResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerGroupName, data);
ContainerGroupResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ContainerGroupData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
{
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "WestUs",
"zones": [
"1"
],
"name": "demo1",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5,
"gpu": {
"count": 1,
"sku": "K80"
}
}
},
"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"
],
"searchDomains": "cluster.local svc.cluster.local",
"options": "ndots:2"
},
"imageRegistryCredentials": [],
"ipAddress": {
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
],
"type": "Public",
"dnsNameLabel": "dnsnamelabel1",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"fqdn": "dnsnamelabel1.azure-container.io"
},
"osType": "Linux",
"provisioningState": "Succeeded",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {}
}
]
},
"type": "Microsoft.ContainerInstance/containerGroups"
}
{
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "WestUs",
"zones": [
"1"
],
"name": "demo1",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5,
"gpu": {
"count": 1,
"sku": "K80"
}
}
},
"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": {
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
],
"type": "Public",
"dnsNameLabel": "dnsnamelabel1",
"autoGeneratedDomainNameLabelScope": "Unsecure",
"fqdn": "dnsnamelabel1.azure-container.io"
},
"osType": "Linux",
"provisioningState": "Succeeded",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {}
}
]
},
"type": "Microsoft.ContainerInstance/containerGroups"
}
ContainerGroupsCreateWithPriority
Esempio di richiesta
PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01
{
"properties": {
"sku": "Standard",
"containers": [
{
"name": "test-container-001",
"properties": {
"image": "alpine:latest",
"command": [
"/bin/sh",
"-c",
"sleep 10"
],
"resources": {
"requests": {
"memoryInGB": 1,
"cpu": 1
}
}
}
}
],
"restartPolicy": "Never",
"osType": "Linux",
"priority": "Spot"
},
"location": "eastus"
}
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:
* specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/
* ContainerGroupsCreatePriority.json
*/
/**
* Sample code: ContainerGroupsCreateWithPriority.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void containerGroupsCreateWithPriority(com.azure.resourcemanager.AzureResourceManager azure) {
azure.containerGroups().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="subid",
)
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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
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),
},
Location: to.Ptr("eastus"),
}, 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 pull 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.ContainerGroup = armcontainerinstance.ContainerGroup{
// 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"),
// },
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// Priority: to.Ptr(armcontainerinstance.ContainerGroupPrioritySpot),
// ProvisioningState: to.Ptr("Succeeded"),
// RestartPolicy: to.Ptr(armcontainerinstance.ContainerGroupRestartPolicyNever),
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
// },
// 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"),
// }
}
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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsCreatePriority.json
*/
async function containerGroupsCreateWithPriority() {
const subscriptionId = process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
containers: [
{
name: "test-container-001",
command: ["/bin/sh", "-c", "sleep 10"],
image: "alpine:latest",
resources: { requests: { cpu: 1, memoryInGB: 1 } },
},
],
location: "eastus",
osType: "Linux",
priority: "Spot",
restartPolicy: "Never",
sku: "Standard",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ContainerInstance.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.ContainerInstance;
// Generated from example definition: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsCreatePriority.json
// this example is just showing the usage of "ContainerGroups_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "demo";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this ContainerGroupResource
ContainerGroupCollection collection = resourceGroupResource.GetContainerGroups();
// invoke the operation
string containerGroupName = "demo1";
ContainerGroupData data = new ContainerGroupData(new AzureLocation("eastus"), new ContainerInstanceContainer[]
{
new ContainerInstanceContainer("test-container-001","alpine:latest",new ContainerResourceRequirements(new ContainerResourceRequestsContent(1,1)))
{
Command =
{
"/bin/sh","-c","sleep 10"
},
}
}, ContainerInstanceOperatingSystemType.Linux)
{
RestartPolicy = ContainerGroupRestartPolicy.Never,
Sku = ContainerGroupSku.Standard,
Priority = ContainerGroupPriority.Spot,
};
ArmOperation<ContainerGroupResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerGroupName, data);
ContainerGroupResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ContainerGroupData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
{
"properties": {
"sku": "Standard",
"provisioningState": "Succeeded",
"containers": [
{
"name": "test-container-001",
"properties": {
"image": "alpine:latest",
"command": [
"/bin/sh",
"-c",
"sleep 10"
],
"ports": [],
"environmentVariables": [],
"resources": {
"requests": {
"memoryInGB": 1,
"cpu": 1
}
}
}
}
],
"initContainers": [],
"restartPolicy": "Never",
"osType": "Linux",
"instanceView": {
"events": [],
"state": "Succeeded"
},
"priority": "Spot"
},
"id": "/subscriptions/subId/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"location": "eastus"
}
{
"properties": {
"sku": "Standard",
"provisioningState": "Created",
"containers": [
{
"name": "test-container-001",
"properties": {
"image": "alpine:latest",
"command": [
"/bin/sh",
"-c",
"sleep 10"
],
"ports": [],
"environmentVariables": [],
"resources": {
"requests": {
"memoryInGB": 1,
"cpu": 1
}
}
}
}
],
"initContainers": [],
"restartPolicy": "Never",
"osType": "Linux",
"instanceView": {
"events": [],
"state": "Created"
},
"priority": "Spot"
},
"id": "/subscriptions/subId/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"location": "eastus"
}
ContainerGroupWithEncryptionProperties
Esempio di richiesta
PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01
{
"location": "eastus2",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {}
}
},
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
}
}
}
],
"imageRegistryCredentials": [],
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"type": "Public"
},
"osType": "Linux",
"encryptionProperties": {
"vaultBaseUrl": "https://testkeyvault.vault.azure.net",
"keyName": "test-key",
"keyVersion": "<key version>",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity"
}
}
}
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:
* specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/
* ContainerGroupEncryptionProperties.json
*/
/**
* Sample code: ContainerGroupWithEncryptionProperties.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void containerGroupWithEncryptionProperties(com.azure.resourcemanager.AzureResourceManager azure) {
azure.containerGroups().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="subid",
)
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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/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("<subscription-id>", 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": {},
},
},
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),
},
Location: to.Ptr("eastus2"),
}, 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 pull 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.ContainerGroup = armcontainerinstance.ContainerGroup{
// 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>"),
// },
// },
// },
// 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),
// }},
// },
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
// ProvisioningState: to.Ptr("Succeeded"),
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
// },
// 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"),
// Location: to.Ptr("eastus2"),
// }
}
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: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupEncryptionProperties.json
*/
async function containerGroupWithEncryptionProperties() {
const subscriptionId = process.env["CONTAINERINSTANCE_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["CONTAINERINSTANCE_RESOURCE_GROUP"] || "demo";
const containerGroupName = "demo1";
const containerGroup = {
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",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000000000000000000000000000/resourcegroups/testRg/providers/MicrosoftManagedIdentity/userAssignedIdentities/containerGroupIdentity":
{},
},
},
imageRegistryCredentials: [],
ipAddress: { type: "Public", ports: [{ port: 80, protocol: "TCP" }] },
location: "eastus2",
osType: "Linux",
};
const credential = new DefaultAzureCredential();
const client = new ContainerInstanceManagementClient(credential, subscriptionId);
const result = await client.containerGroups.beginCreateOrUpdateAndWait(
resourceGroupName,
containerGroupName,
containerGroup
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ContainerInstance.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.ContainerInstance;
// Generated from example definition: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupEncryptionProperties.json
// this example is just showing the usage of "ContainerGroups_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "demo";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this ContainerGroupResource
ContainerGroupCollection collection = resourceGroupResource.GetContainerGroups();
// invoke the operation
string containerGroupName = "demo1";
ContainerGroupData data = new ContainerGroupData(new AzureLocation("eastus2"), new ContainerInstanceContainer[]
{
new ContainerInstanceContainer("demo1","nginx",new ContainerResourceRequirements(new ContainerResourceRequestsContent(1.5,1)))
{
Command =
{
},
Ports =
{
new ContainerPort(80)
},
EnvironmentVariables =
{
},
}
}, ContainerInstanceOperatingSystemType.Linux)
{
Identity = new ManagedServiceIdentity("UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity")] = new UserAssignedIdentity(),
},
},
ImageRegistryCredentials =
{
},
IPAddress = new ContainerGroupIPAddress(new ContainerGroupPort[]
{
new ContainerGroupPort(80)
{
Protocol = ContainerGroupNetworkProtocol.Tcp,
}
}, ContainerGroupIPAddressType.Public),
EncryptionProperties = new ContainerGroupEncryptionProperties(new Uri("https://testkeyvault.vault.azure.net"), "test-key", "<key version>")
{
Identity = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
},
};
ArmOperation<ContainerGroupResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerGroupName, data);
ContainerGroupResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ContainerGroupData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
{
"properties": {
"sku": "Standard",
"encryptionProperties": {
"vaultBaseUrl": "https://testkeyvault.vault.azure.net/",
"keyName": "test-key",
"keyVersion": "<key version>",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity"
},
"provisioningState": "Pending",
"containers": [
{
"name": "demo1",
"properties": {
"image": "nginx",
"command": [],
"ports": [
{
"port": 80
}
],
"environmentVariables": [],
"resources": {
"requests": {
"memoryInGB": 1.5,
"cpu": 1
}
}
}
}
],
"initContainers": [],
"imageRegistryCredentials": [],
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"type": "Public"
},
"osType": "Linux",
"instanceView": {
"events": [],
"state": "Pending"
}
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {
"principalId": "<principal id>",
"clientId": "<client id>"
}
},
"tenantId": "<tenant id>",
"type": "UserAssigned"
},
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"location": "eastus2"
}
{
"properties": {
"sku": "Standard",
"encryptionProperties": {
"vaultBaseUrl": "https://testkeyvault.vault.azure.net/",
"keyName": "test-key",
"keyVersion": "key version",
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity"
},
"provisioningState": "Running",
"containers": [
{
"name": "demo1",
"properties": {
"image": "nginx",
"command": [],
"ports": [
{
"port": 80
}
],
"environmentVariables": [],
"resources": {
"requests": {
"memoryInGB": 1.5,
"cpu": 1
}
}
}
}
],
"initContainers": [],
"imageRegistryCredentials": [],
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"type": "Public"
},
"osType": "Linux",
"instanceView": {
"events": [],
"state": "Pending"
}
},
"identity": {
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {
"principalId": "<principal id>",
"clientId": "<client id>"
}
},
"tenantId": "<tenant id>",
"type": "UserAssigned"
},
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"name": "demo1",
"type": "Microsoft.ContainerInstance/containerGroups",
"location": "eastus2"
}
Definizioni
Nome |
Descrizione |
AzureFileVolume
|
Proprietà del volume file di Azure. Le condivisioni file di Azure vengono montate come volumi.
|
CloudError
|
Risposta di errore del servizio Istanza contenitore.
|
CloudErrorBody
|
Risposta di errore del servizio Istanza contenitore.
|
ConfidentialComputeProperties
|
Proprietà per il gruppo di contenitori riservati
|
Container
|
Istanza del contenitore.
|
ContainerExec
|
Comando di esecuzione del contenitore, per il probe di attività o idoneità
|
ContainerGroup
|
Gruppo di contenitori.
|
ContainerGroupDiagnostics
|
Informazioni di diagnostica del gruppo di contenitori.
|
ContainerGroupIdentity
|
Identità per il gruppo di contenitori.
|
ContainerGroupIpAddressType
|
Specifica se l'indirizzo IP è esposto alla rete Internet pubblica o alla rete virtuale privata.
|
ContainerGroupNetworkProtocol
|
Protocollo associato alla porta.
|
ContainerGroupPriority
|
Priorità del gruppo di contenitori.
|
ContainerGroupProperties.properties.InstanceView
|
Visualizzazione dell'istanza del gruppo di contenitori. Valido solo in risposta.
|
ContainerGroupRestartPolicy
|
Criteri di riavvio per tutti i contenitori all'interno del gruppo di contenitori.
-
Always Riavviare sempre
-
OnFailure Riavvio in caso di errore
-
Never Non riavviare mai
|
ContainerGroupSku
|
SKU del gruppo di contenitori.
|
ContainerGroupSubnetId
|
Informazioni sulla subnet del gruppo di contenitori.
|
ContainerHttpGet
|
Impostazioni Http Get del contenitore per il probe di attività o idoneità
|
ContainerNetworkProtocol
|
Protocollo associato alla porta.
|
ContainerPort
|
Porta esposta nell'istanza del contenitore.
|
ContainerProbe
|
Probe del contenitore, per attività o idoneità
|
ContainerState
|
Stato dell'istanza del contenitore.
|
DeploymentExtensionSpec
|
Sidecar di estensione da aggiungere alla distribuzione.
|
DnsConfiguration
|
Configurazione DNS per il gruppo di contenitori.
|
dnsNameLabelReusePolicy
|
Valore che rappresenta l'enumerazione di sicurezza. Il valore "Non protetto" è il valore predefinito se non è selezionato e indica che l'etichetta del nome di dominio dell'oggetto non è protetta dall'acquisizione del sottodominio. Il valore "TenantReuse" è il valore predefinito se selezionato e indica che l'etichetta del nome di dominio dell'oggetto può essere riutilizzata all'interno dello stesso tenant. Il valore "SubscriptionReuse" indica che l'etichetta del nome di dominio dell'oggetto può essere riutilizzata all'interno della stessa sottoscrizione. Il valore "ResourceGroupReuse" indica che l'etichetta del nome di dominio dell'oggetto può essere riutilizzata all'interno dello stesso gruppo di risorse. Il valore 'NoReuse' indica che l'etichetta del nome di dominio dell'oggetto non può essere riutilizzata all'interno dello stesso gruppo di risorse, sottoscrizione o tenant.
|
EmptyDirVolume
|
Volume di directory vuoto.
|
EncryptionProperties
|
Proprietà di crittografia del gruppo di contenitori.
|
EnvironmentVariable
|
Variabile di ambiente da impostare all'interno dell'istanza del contenitore.
|
Event
|
Un gruppo di contenitori o un evento di istanza del contenitore.
|
GitRepoVolume
|
Rappresenta un volume popolato con il contenuto di un repository Git
|
GpuResource
|
Risorsa GPU.
|
GpuSku
|
SKU della risorsa GPU.
|
HttpHeader
|
Intestazione HTTP.
|
ImageRegistryCredential
|
Credenziali del Registro di sistema delle immagini.
|
InitContainerDefinition
|
Definizione del contenitore init.
|
InitContainerPropertiesDefinition.InstanceView
|
Visualizzazione dell'istanza del contenitore init. Valido solo in risposta.
|
InstanceView
|
Visualizzazione dell'istanza dell'istanza del contenitore. Valido solo in risposta.
|
IpAddress
|
Indirizzo IP per il gruppo di contenitori.
|
LogAnalytics
|
Informazioni di Log Analytics del gruppo di contenitori.
|
LogAnalyticsLogType
|
Tipo di log da utilizzare.
|
OperatingSystemTypes
|
Tipo di sistema operativo richiesto dai contenitori nel gruppo di contenitori.
|
Port
|
Porta esposta nel gruppo di contenitori.
|
ResourceIdentityType
|
Tipo di identità usato per il gruppo di contenitori. Il tipo 'SystemAssigned, UserAssigned' include sia un'identità creata in modo implicito che un set di identità assegnate dall'utente. Il tipo 'None' rimuoverà tutte le identità dal gruppo di contenitori.
|
ResourceLimits
|
Limiti delle risorse.
|
ResourceRequests
|
Richieste di risorse.
|
ResourceRequirements
|
Requisiti delle risorse.
|
Scheme
|
Schema.
|
SecurityContextCapabilitiesDefinition
|
Funzionalità da aggiungere o eliminare da un contenitore.
|
SecurityContextDefinition
|
Contesto di sicurezza per il contenitore.
|
UserAssignedIdentities
|
Elenco di identità utente associate al gruppo di contenitori. I riferimenti alla chiave del dizionario delle identità utente saranno id risorsa ARM nel formato :'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
|
Volume
|
Proprietà del volume.
|
VolumeMount
|
Proprietà del montaggio del volume.
|
AzureFileVolume
Object
Proprietà del volume file di Azure. Le condivisioni file di Azure vengono montate come volumi.
Nome |
Tipo |
Descrizione |
readOnly
|
boolean
|
Flag che indica se il file di Azure condiviso come volume è di sola lettura.
|
shareName
|
string
|
Nome della condivisione file di Azure da montare come volume.
|
storageAccountKey
|
string
|
Chiave di accesso dell'account di archiviazione usata per accedere alla condivisione file di Azure.
|
storageAccountName
|
string
|
Nome dell'account di archiviazione che contiene la condivisione file di Azure.
|
CloudError
Object
Risposta di errore del servizio Istanza contenitore.
Nome |
Tipo |
Descrizione |
error
|
CloudErrorBody
|
Risposta di errore del servizio Istanza contenitore.
|
CloudErrorBody
Object
Risposta di errore del servizio Istanza contenitore.
Nome |
Tipo |
Descrizione |
code
|
string
|
Identificatore dell'errore. I codici sono invarianti e devono essere utilizzati a livello di codice.
|
details
|
CloudErrorBody[]
|
Elenco di dettagli aggiuntivi sull'errore.
|
message
|
string
|
Messaggio che descrive l'errore, destinato a essere adatto per la visualizzazione in un'interfaccia utente.
|
target
|
string
|
Destinazione dell'errore specifico. Ad esempio, il nome della proprietà in errore.
|
ConfidentialComputeProperties
Object
Proprietà per il gruppo di contenitori riservati
Nome |
Tipo |
Descrizione |
ccePolicy
|
string
|
Criteri di imposizione del confidential compute codificati in base64
|
Container
Object
Istanza del contenitore.
Nome |
Tipo |
Descrizione |
name
|
string
|
Nome fornito dall'utente dell'istanza del contenitore.
|
properties.command
|
string[]
|
Comandi da eseguire all'interno dell'istanza del contenitore nel formato exec.
|
properties.environmentVariables
|
EnvironmentVariable[]
|
Variabili di ambiente da impostare nell'istanza del contenitore.
|
properties.image
|
string
|
Nome dell'immagine usata per creare l'istanza del contenitore.
|
properties.instanceView
|
InstanceView
|
Visualizzazione dell'istanza dell'istanza del contenitore. Valido solo in risposta.
|
properties.livenessProbe
|
ContainerProbe
|
Probe di attività.
|
properties.ports
|
ContainerPort[]
|
Porte esposte nell'istanza del contenitore.
|
properties.readinessProbe
|
ContainerProbe
|
Probe di idoneità.
|
properties.resources
|
ResourceRequirements
|
Requisiti delle risorse dell'istanza del contenitore.
|
properties.securityContext
|
SecurityContextDefinition
|
Proprietà di sicurezza del contenitore.
|
properties.volumeMounts
|
VolumeMount[]
|
Il volume viene montato per l'istanza del contenitore.
|
ContainerExec
Object
Comando di esecuzione del contenitore, per il probe di attività o idoneità
Nome |
Tipo |
Descrizione |
command
|
string[]
|
Comandi da eseguire all'interno del contenitore.
|
ContainerGroup
Object
Gruppo di contenitori.
Nome |
Tipo |
Descrizione |
id
|
string
|
ID risorsa.
|
identity
|
ContainerGroupIdentity
|
Identità del gruppo di contenitori, se configurata.
|
location
|
string
|
Percorso della risorsa.
|
name
|
string
|
Nome della risorsa.
|
properties.confidentialComputeProperties
|
ConfidentialComputeProperties
|
Proprietà per il gruppo di contenitori riservati
|
properties.containers
|
Container[]
|
Contenitori all'interno del gruppo di contenitori.
|
properties.diagnostics
|
ContainerGroupDiagnostics
|
Informazioni di diagnostica per un gruppo di contenitori.
|
properties.dnsConfig
|
DnsConfiguration
|
Informazioni di configurazione DNS per un gruppo di contenitori.
|
properties.encryptionProperties
|
EncryptionProperties
|
Proprietà di crittografia per un gruppo di contenitori.
|
properties.extensions
|
DeploymentExtensionSpec[]
|
estensioni usate da kubelet virtuale
|
properties.imageRegistryCredentials
|
ImageRegistryCredential[]
|
Credenziali del Registro immagini da cui viene creato il gruppo di contenitori.
|
properties.initContainers
|
InitContainerDefinition[]
|
Contenitori init per un gruppo di contenitori.
|
properties.instanceView
|
ContainerGroupProperties.properties.InstanceView
|
Visualizzazione dell'istanza del gruppo di contenitori. Valido solo in risposta.
|
properties.ipAddress
|
IpAddress
|
Tipo di indirizzo IP del gruppo di contenitori.
|
properties.osType
|
OperatingSystemTypes
|
Tipo di sistema operativo richiesto dai contenitori nel gruppo di contenitori.
|
properties.priority
|
ContainerGroupPriority
|
Priorità del gruppo di contenitori.
|
properties.provisioningState
|
string
|
Stato di provisioning del gruppo di contenitori. Questo viene visualizzato solo nella risposta.
|
properties.restartPolicy
|
ContainerGroupRestartPolicy
|
Criteri di riavvio per tutti i contenitori all'interno del gruppo di contenitori.
-
Always Riavviare sempre
-
OnFailure Riavvio in caso di errore
-
Never Non riavviare mai
|
properties.sku
|
ContainerGroupSku
|
SKU per un gruppo di contenitori.
|
properties.subnetIds
|
ContainerGroupSubnetId[]
|
ID risorsa subnet per un gruppo di contenitori.
|
properties.volumes
|
Volume[]
|
Elenco di volumi che possono essere montati da contenitori in questo gruppo di contenitori.
|
tags
|
object
|
Tag di risorsa.
|
type
|
string
|
Tipo di risorsa.
|
zones
|
string[]
|
Zone per il gruppo di contenitori.
|
ContainerGroupDiagnostics
Object
Informazioni di diagnostica del gruppo di contenitori.
Nome |
Tipo |
Descrizione |
logAnalytics
|
LogAnalytics
|
Informazioni di Log Analytics del gruppo di contenitori.
|
ContainerGroupIdentity
Object
Identità per il gruppo di contenitori.
Nome |
Tipo |
Descrizione |
principalId
|
string
|
ID principale dell'identità del gruppo di contenitori. Questa proprietà verrà fornita solo per un'identità assegnata dal sistema.
|
tenantId
|
string
|
ID tenant associato al gruppo di contenitori. Questa proprietà verrà fornita solo per un'identità assegnata dal sistema.
|
type
|
ResourceIdentityType
|
Tipo di identità usato per il gruppo di contenitori. Il tipo 'SystemAssigned, UserAssigned' include sia un'identità creata in modo implicito che un set di identità assegnate dall'utente. Il tipo 'None' rimuoverà tutte le identità dal gruppo di contenitori.
|
userAssignedIdentities
|
<string,
UserAssignedIdentities>
|
Elenco di identità utente associate al gruppo di contenitori.
|
ContainerGroupIpAddressType
Enumerazione
Specifica se l'indirizzo IP è esposto alla rete Internet pubblica o alla rete virtuale privata.
Valore |
Descrizione |
Private
|
|
Public
|
|
ContainerGroupNetworkProtocol
Enumerazione
Protocollo associato alla porta.
Valore |
Descrizione |
TCP
|
|
UDP
|
|
ContainerGroupPriority
Enumerazione
Priorità del gruppo di contenitori.
Valore |
Descrizione |
Regular
|
|
Spot
|
|
ContainerGroupProperties.properties.InstanceView
Object
Visualizzazione dell'istanza del gruppo di contenitori. Valido solo in risposta.
Nome |
Tipo |
Descrizione |
events
|
Event[]
|
Eventi di questo gruppo di contenitori.
|
state
|
string
|
Stato del gruppo di contenitori. Valido solo in risposta.
|
ContainerGroupRestartPolicy
Enumerazione
Criteri di riavvio per tutti i contenitori all'interno del gruppo di contenitori.
-
Always
Riavviare sempre
-
OnFailure
Riavvio in caso di errore
-
Never
Non riavviare mai
Valore |
Descrizione |
Always
|
|
Never
|
|
OnFailure
|
|
ContainerGroupSku
Enumerazione
SKU del gruppo di contenitori.
Valore |
Descrizione |
Confidential
|
|
Dedicated
|
|
Standard
|
|
ContainerGroupSubnetId
Object
Informazioni sulla subnet del gruppo di contenitori.
Nome |
Tipo |
Descrizione |
id
|
string
|
ID risorsa della rete virtuale e della subnet.
|
name
|
string
|
Nome descrittivo per la subnet.
|
ContainerHttpGet
Object
Impostazioni Http Get del contenitore per il probe di attività o idoneità
Nome |
Tipo |
Descrizione |
httpHeaders
|
HttpHeader[]
|
Intestazioni HTTP.
|
path
|
string
|
Percorso del probe.
|
port
|
integer
(int32)
|
Numero di porta da sondare.
|
scheme
|
Scheme
|
Schema.
|
ContainerNetworkProtocol
Enumerazione
Protocollo associato alla porta.
Valore |
Descrizione |
TCP
|
|
UDP
|
|
ContainerPort
Object
Porta esposta nell'istanza del contenitore.
Nome |
Tipo |
Descrizione |
port
|
integer
(int32)
|
Numero di porta esposto all'interno del gruppo di contenitori.
|
protocol
|
ContainerNetworkProtocol
|
Protocollo associato alla porta.
|
ContainerProbe
Object
Probe del contenitore, per attività o idoneità
Nome |
Tipo |
Descrizione |
exec
|
ContainerExec
|
Comando di esecuzione da probe
|
failureThreshold
|
integer
(int32)
|
Soglia di errore.
|
httpGet
|
ContainerHttpGet
|
Impostazioni Http Get per il probe
|
initialDelaySeconds
|
integer
(int32)
|
Secondi di ritardo iniziali.
|
periodSeconds
|
integer
(int32)
|
Periodo di secondi.
|
successThreshold
|
integer
(int32)
|
Soglia di esito positivo.
|
timeoutSeconds
|
integer
(int32)
|
Secondi di timeout.
|
ContainerState
Object
Stato dell'istanza del contenitore.
Nome |
Tipo |
Descrizione |
detailStatus
|
string
|
Stato leggibile dello stato dell'istanza del contenitore.
|
exitCode
|
integer
(int32)
|
I codici di uscita dell'istanza del contenitore corrispondono a quelli del comando docker run .
|
finishTime
|
string
(date-time)
|
Data e ora di fine dello stato dell'istanza del contenitore.
|
startTime
|
string
(date-time)
|
Data/ora di inizio dello stato dell'istanza del contenitore.
|
state
|
string
|
Stato dell'istanza del contenitore.
|
DeploymentExtensionSpec
Object
Sidecar di estensione da aggiungere alla distribuzione.
Nome |
Tipo |
Descrizione |
name
|
string
|
Nome dell'estensione.
|
properties.extensionType
|
string
|
Tipo di estensione da aggiungere.
|
properties.protectedSettings
|
object
|
Impostazioni protette per l'estensione.
|
properties.settings
|
object
|
Impostazioni per l'estensione.
|
properties.version
|
string
|
Versione dell'estensione in uso.
|
DnsConfiguration
Object
Configurazione DNS per il gruppo di contenitori.
Nome |
Tipo |
Descrizione |
nameServers
|
string[]
|
Server DNS per il gruppo di contenitori.
|
options
|
string
|
Opzioni DNS per il gruppo di contenitori.
|
searchDomains
|
string
|
Domini di ricerca DNS per la ricerca del nome host nel gruppo di contenitori.
|
dnsNameLabelReusePolicy
Enumerazione
Valore che rappresenta l'enumerazione di sicurezza. Il valore "Non protetto" è il valore predefinito se non è selezionato e indica che l'etichetta del nome di dominio dell'oggetto non è protetta dall'acquisizione del sottodominio. Il valore "TenantReuse" è il valore predefinito se selezionato e indica che l'etichetta del nome di dominio dell'oggetto può essere riutilizzata all'interno dello stesso tenant. Il valore "SubscriptionReuse" indica che l'etichetta del nome di dominio dell'oggetto può essere riutilizzata all'interno della stessa sottoscrizione. Il valore "ResourceGroupReuse" indica che l'etichetta del nome di dominio dell'oggetto può essere riutilizzata all'interno dello stesso gruppo di risorse. Il valore 'NoReuse' indica che l'etichetta del nome di dominio dell'oggetto non può essere riutilizzata all'interno dello stesso gruppo di risorse, sottoscrizione o tenant.
Valore |
Descrizione |
Noreuse
|
|
ResourceGroupReuse
|
|
SubscriptionReuse
|
|
TenantReuse
|
|
Unsecure
|
|
EmptyDirVolume
Object
Volume di directory vuoto.
EncryptionProperties
Object
Proprietà di crittografia del gruppo di contenitori.
Nome |
Tipo |
Descrizione |
identity
|
string
|
Identità gestita dell'insieme di credenziali delle chiavi.
|
keyName
|
string
|
Nome della chiave di crittografia.
|
keyVersion
|
string
|
Versione della chiave di crittografia.
|
vaultBaseUrl
|
string
|
URL di base dell'insieme di credenziali delle chiavi.
|
EnvironmentVariable
Object
Variabile di ambiente da impostare all'interno dell'istanza del contenitore.
Nome |
Tipo |
Descrizione |
name
|
string
|
Nome della variabile di ambiente.
|
secureValue
|
string
|
Valore della variabile di ambiente sicura.
|
value
|
string
|
Valore della variabile di ambiente.
|
Event
Object
Un gruppo di contenitori o un evento di istanza del contenitore.
Nome |
Tipo |
Descrizione |
count
|
integer
(int32)
|
Conteggio dell'evento.
|
firstTimestamp
|
string
(date-time)
|
Data e ora dell'evento registrato meno recente.
|
lastTimestamp
|
string
(date-time)
|
Data e ora dell'evento registrato più recente.
|
message
|
string
|
Messaggio dell'evento.
|
name
|
string
|
Nome dell'evento.
|
type
|
string
|
Tipo di evento.
|
GitRepoVolume
Object
Rappresenta un volume popolato con il contenuto di un repository Git
Nome |
Tipo |
Descrizione |
directory
|
string
|
Nome della directory di destinazione. Non deve contenere o iniziare con '..'. Se viene specificato '.', la directory del volume sarà il repository Git. In caso contrario, se specificato, il volume conterrà il repository Git nella sottodirectory con il nome specificato.
|
repository
|
string
|
URL repository
|
revision
|
string
|
Eseguire il commit dell'hash per la revisione specificata.
|
GpuResource
Object
Risorsa GPU.
Nome |
Tipo |
Descrizione |
count
|
integer
(int32)
|
Conteggio della risorsa GPU.
|
sku
|
GpuSku
|
SKU della risorsa GPU.
|
GpuSku
Enumerazione
SKU della risorsa GPU.
Valore |
Descrizione |
K80
|
|
P100
|
|
V100
|
|
Object
Intestazione HTTP.
Nome |
Tipo |
Descrizione |
name
|
string
|
Nome dell'intestazione.
|
value
|
string
|
Valore dell'intestazione.
|
ImageRegistryCredential
Object
Credenziali del Registro di sistema delle immagini.
Nome |
Tipo |
Descrizione |
identity
|
string
|
Identità del Registro di sistema privato.
|
identityUrl
|
string
|
URL di identità per il Registro di sistema privato.
|
password
|
string
|
Password per il Registro di sistema privato.
|
server
|
string
|
Il server del Registro di sistema delle immagini Docker senza un protocollo, ad esempio "http" e "https".
|
username
|
string
|
Nome utente per il Registro di sistema privato.
|
InitContainerDefinition
Object
Definizione del contenitore init.
Nome |
Tipo |
Descrizione |
name
|
string
|
Nome del contenitore init.
|
properties.command
|
string[]
|
Comando da eseguire all'interno del contenitore init nel formato exec.
|
properties.environmentVariables
|
EnvironmentVariable[]
|
Variabili di ambiente da impostare nel contenitore init.
|
properties.image
|
string
|
Immagine del contenitore init.
|
properties.instanceView
|
InitContainerPropertiesDefinition.InstanceView
|
Visualizzazione dell'istanza del contenitore init. Valido solo in risposta.
|
properties.securityContext
|
SecurityContextDefinition
|
Proprietà di sicurezza del contenitore.
|
properties.volumeMounts
|
VolumeMount[]
|
Il volume monta il contenitore init.
|
InitContainerPropertiesDefinition.InstanceView
Object
Visualizzazione dell'istanza del contenitore init. Valido solo in risposta.
Nome |
Tipo |
Descrizione |
currentState
|
ContainerState
|
Stato corrente del contenitore init.
|
events
|
Event[]
|
Eventi del contenitore init.
|
previousState
|
ContainerState
|
Stato precedente del contenitore init.
|
restartCount
|
integer
(int32)
|
Numero di volte in cui il contenitore init è stato riavviato.
|
InstanceView
Object
Visualizzazione dell'istanza dell'istanza del contenitore. Valido solo in risposta.
Nome |
Tipo |
Descrizione |
currentState
|
ContainerState
|
Stato corrente dell'istanza del contenitore.
|
events
|
Event[]
|
Eventi dell'istanza del contenitore.
|
previousState
|
ContainerState
|
Stato precedente dell'istanza del contenitore.
|
restartCount
|
integer
(int32)
|
Numero di volte in cui l'istanza del contenitore è stata riavviata.
|
IpAddress
Object
Indirizzo IP per il gruppo di contenitori.
Nome |
Tipo |
Valore predefinito |
Descrizione |
autoGeneratedDomainNameLabelScope
|
dnsNameLabelReusePolicy
|
Unsecure
|
Valore che rappresenta l'enumerazione di sicurezza. Il valore "Non protetto" è il valore predefinito se non è selezionato e indica che l'etichetta del nome di dominio dell'oggetto non è protetta dall'acquisizione del sottodominio. Il valore "TenantReuse" è il valore predefinito se selezionato e indica che l'etichetta del nome di dominio dell'oggetto può essere riutilizzata all'interno dello stesso tenant. Il valore "SubscriptionReuse" indica che l'etichetta del nome di dominio dell'oggetto può essere riutilizzata all'interno della stessa sottoscrizione. Il valore "ResourceGroupReuse" indica che l'etichetta del nome di dominio dell'oggetto può essere riutilizzata all'interno dello stesso gruppo di risorse. Il valore 'NoReuse' indica che l'etichetta del nome di dominio dell'oggetto non può essere riutilizzata all'interno dello stesso gruppo di risorse, sottoscrizione o tenant.
|
dnsNameLabel
|
string
|
|
Etichetta del nome DNS per l'INDIRIZZO IP.
|
fqdn
|
string
|
|
FQDN per l'INDIRIZZO IP.
|
ip
|
string
|
|
Ip esposto alla rete Internet pubblica.
|
ports
|
Port[]
|
|
Elenco di porte esposte nel gruppo di contenitori.
|
type
|
ContainerGroupIpAddressType
|
|
Specifica se l'indirizzo IP è esposto alla rete Internet pubblica o alla rete virtuale privata.
|
LogAnalytics
Object
Informazioni di Log Analytics del gruppo di contenitori.
Nome |
Tipo |
Descrizione |
logType
|
LogAnalyticsLogType
|
Tipo di log da utilizzare.
|
metadata
|
object
|
Metadati per Log Analytics.
|
workspaceId
|
string
|
ID dell'area di lavoro per Log Analytics
|
workspaceKey
|
string
|
Chiave dell'area di lavoro per Log Analytics
|
workspaceResourceId
|
string
|
ID risorsa dell'area di lavoro per Log Analytics
|
LogAnalyticsLogType
Enumerazione
Tipo di log da utilizzare.
Valore |
Descrizione |
ContainerInsights
|
|
ContainerInstanceLogs
|
|
OperatingSystemTypes
Enumerazione
Tipo di sistema operativo richiesto dai contenitori nel gruppo di contenitori.
Valore |
Descrizione |
Linux
|
|
Windows
|
|
Port
Object
Porta esposta nel gruppo di contenitori.
ResourceIdentityType
Enumerazione
Tipo di identità usato per il gruppo di contenitori. Il tipo 'SystemAssigned, UserAssigned' include sia un'identità creata in modo implicito che un set di identità assegnate dall'utente. Il tipo 'None' rimuoverà tutte le identità dal gruppo di contenitori.
Valore |
Descrizione |
None
|
|
SystemAssigned
|
|
SystemAssigned, UserAssigned
|
|
UserAssigned
|
|
ResourceLimits
Object
Limiti delle risorse.
Nome |
Tipo |
Descrizione |
cpu
|
number
(double)
|
Limite della CPU di questa istanza del contenitore.
|
gpu
|
GpuResource
|
Limite GPU di questa istanza del contenitore.
|
memoryInGB
|
number
(double)
|
Limite di memoria in GB di questa istanza del contenitore.
|
ResourceRequests
Object
Richieste di risorse.
Nome |
Tipo |
Descrizione |
cpu
|
number
(double)
|
Richiesta CPU di questa istanza del contenitore.
|
gpu
|
GpuResource
|
Richiesta GPU di questa istanza del contenitore.
|
memoryInGB
|
number
(double)
|
Richiesta di memoria in GB di questa istanza del contenitore.
|
ResourceRequirements
Object
Requisiti delle risorse.
Nome |
Tipo |
Descrizione |
limits
|
ResourceLimits
|
Limiti delle risorse di questa istanza del contenitore.
|
requests
|
ResourceRequests
|
Richieste di risorse di questa istanza del contenitore.
|
Scheme
Enumerazione
Schema.
Valore |
Descrizione |
http
|
|
https
|
|
SecurityContextCapabilitiesDefinition
Object
Funzionalità da aggiungere o eliminare da un contenitore.
Nome |
Tipo |
Descrizione |
add
|
string[]
|
Funzionalità da aggiungere al contenitore.
|
drop
|
string[]
|
Funzionalità da eliminare dal contenitore.
|
SecurityContextDefinition
Object
Contesto di sicurezza per il contenitore.
Nome |
Tipo |
Descrizione |
allowPrivilegeEscalation
|
boolean
|
Valore booleano che indica se il processo init può elevare i privilegi
|
capabilities
|
SecurityContextCapabilitiesDefinition
|
Funzionalità da aggiungere o eliminare da un contenitore.
|
privileged
|
boolean
|
Flag per determinare se le autorizzazioni del contenitore sono elevate in Privileged.
|
runAsGroup
|
integer
(int32)
|
Imposta il GID utente per il contenitore.
|
runAsUser
|
integer
(int32)
|
Imposta l'UID utente per il contenitore.
|
seccompProfile
|
string
|
stringa con codifica Base64 contenente il contenuto del codice JSON nel profilo seccomp
|
UserAssignedIdentities
Object
Elenco di identità utente associate al gruppo di contenitori. I riferimenti alla chiave del dizionario delle identità utente saranno id risorsa ARM nel formato :'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
Nome |
Tipo |
Descrizione |
clientId
|
string
|
ID client dell'identità assegnata dall'utente.
|
principalId
|
string
|
ID principale dell'identità assegnata dall'utente.
|
Volume
Object
Proprietà del volume.
Nome |
Tipo |
Descrizione |
azureFile
|
AzureFileVolume
|
Volume file di Azure.
|
emptyDir
|
EmptyDirVolume
|
Volume di directory vuoto.
|
gitRepo
|
GitRepoVolume
|
Volume del repository Git.
|
name
|
string
|
Nome del volume.
|
secret
|
object
|
Volume segreto.
|
VolumeMount
Object
Proprietà del montaggio del volume.
Nome |
Tipo |
Descrizione |
mountPath
|
string
|
Percorso all'interno del contenitore in cui deve essere montato il volume. Non deve contenere due punti (:).
|
name
|
string
|
Nome del montaggio del volume.
|
readOnly
|
boolean
|
Flag che indica se il montaggio del volume è di sola lettura.
|