New-AzContainerInstanceContainerGroupProfile
Create or update container group profiles with specified configurations.
Syntax
Default (Default)
New-AzContainerInstanceContainerGroupProfile
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
-Container <IContainer[]>
-OSType <OperatingSystemTypes>
[-ConfidentialComputePropertyCcePolicy <String>]
[-EncryptionPropertyIdentity <String>]
[-EncryptionPropertyKeyName <String>]
[-EncryptionPropertyKeyVersion <String>]
[-EncryptionPropertyVaultBaseUrl <String>]
[-Extension <IDeploymentExtensionSpec[]>]
[-IPAddressAutoGeneratedDomainNameLabelScope <DnsNameLabelReusePolicy>]
[-IPAddressDnsNameLabel <String>]
[-IPAddressIP <String>]
[-IPAddressPort <IPort[]>]
[-IPAddressType <ContainerGroupIPAddressType>]
[-ImageRegistryCredential <IImageRegistryCredential[]>]
[-InitContainer <IInitContainerDefinition[]>]
[-Location <String>]
[-LogAnalyticLogType <LogAnalyticsLogType>]
[-LogAnalyticMetadata <Hashtable>]
[-LogAnalyticWorkspaceId <String>]
[-LogAnalyticWorkspaceKey <String>]
[-LogAnalyticWorkspaceResourceId <String>]
[-Priority <ContainerGroupPriority>]
[-RestartPolicy <ContainerGroupRestartPolicy>]
[-Sku <ContainerGroupSku>]
[-Tag <Hashtable>]
[-Volume <IVolume[]>]
[-Zone <String[]>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Create or update container group profiles with specified configurations.
Examples
Example 1: Create a container group profile with a container instance and request a public IP address with opening ports
$port1 = New-AzContainerInstancePortObject -Port 8000 -Protocol TCP
$port2 = New-AzContainerInstancePortObject -Port 8001 -Protocol TCP
$container = New-AzContainerInstanceObject -Name test-container -Image nginx -RequestCpu 1 -RequestMemoryInGb 1.5 -Port @($port1, $port2)
$containerGroupProfile = New-AzContainerInstanceContainerGroupProfile -ResourceGroupName test-rg -Name test-cgp -Location eastus -Container $container -OsType Linux -RestartPolicy "Never" -IpAddressType Public
Location Name Zone ResourceGroupName
-------- ---- ---- -----------------
eastus test-cgp test-rg
This commands creates a container group profile with a container instance, whose image is latest nginx, and requests a public IP address with opening port 8000 and 8001.
Example 2: Create container group profile and runs a custom script inside the container.
$pwd = ConvertTo-SecureString -String "****" -AsPlainText -Force
$env1 = New-AzContainerInstanceEnvironmentVariableObject -Name "env1" -Value "value1"
$env2 = New-AzContainerInstanceEnvironmentVariableObject -Name "env2" -SecureValue $pwd
$container = New-AzContainerInstanceObject -Name test-container -Image alpine -Command "/bin/sh -c myscript.sh" -EnvironmentVariable @($env1, $env2) -RequestCpu 1 -RequestMemoryInGb 1.5
$containerGroupProfile = New-AzContainerInstanceContainerGroupProfile -ResourceGroupName test-rg -Name test-cgp -Location eastus -Container $container -OsType Linux
Location Name Zone ResourceGroupName
-------- ---- ---- -----------------
eastus test-cgp test-rg
This commands creates a container group profile and runs a custom script inside the container.
Example 3: Create a container group profile with a container instance using image nginx in Azure Container Registry
$pwd = ConvertTo-SecureString -String "****" -AsPlainText -Force
$container = New-AzContainerInstanceObject -Name test-container -Image myacr.azurecr.io/nginx:latest -RequestCpu 1 -RequestMemoryInGb 1.5
$imageRegistryCredential = New-AzContainerGroupImageRegistryCredentialObject -Server "myacr.azurecr.io" -Username "username" -Password $pwd
$containerGroupProfile = New-AzContainerInstanceContainerGroupProfile -ResourceGroupName test-rg -Name test-cgp -Location eastus -Container $container -ImageRegistryCredential $imageRegistryCredential -OsType Linux
Location Name Zone ResourceGroupName
-------- ---- ---- -----------------
eastus test-cgp test-rg
This commands creates a container group profile with a container instance, whose image is nginx in Azure Container Registry.
Example 4: Create a container group profile with Spot priority and a container instance using nginx image
$container = New-AzContainerInstanceObject -Name test-container -Image nginx -RequestCpu 1 -RequestMemoryInGb 1.5
$containerGroupProfile = New-AzContainerInstanceContainerGroupProfile -ResourceGroupName test-rg -Name test-cgp -Location eastus -Container $container -OsType Linux -RestartPolicy Never -Priority Spot
Location Name Zone ResourceGroupName
-------- ---- ---- -----------------
eastus test-cgp test-rg
This commands creates a container group profile with spot priority and a container instance, whose image is nginx.
Parameters
-ConfidentialComputePropertyCcePolicy
The base64 encoded confidential compute enforcement policy
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Container
The containers within the container group.
To construct, see NOTES section for CONTAINER properties and create a hash table.
Parameter properties
Type: IContainer [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The DefaultProfile parameter is not functional.
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
Parameter properties
Type: PSObject
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzureRMContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-EncryptionPropertyIdentity
The keyvault managed identity.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-EncryptionPropertyKeyName
The encryption key name.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-EncryptionPropertyKeyVersion
The encryption key version.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-EncryptionPropertyVaultBaseUrl
The keyvault base url.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Extension
extensions used by virtual kubelet
To construct, see NOTES section for EXTENSION properties and create a hash table.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ImageRegistryCredential
The image registry credentials by which the container group is created from.
To construct, see NOTES section for IMAGEREGISTRYCREDENTIAL properties and create a hash table.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-InitContainer
The init containers for a container group.
To construct, see NOTES section for INITCONTAINER properties and create a hash table.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-IPAddressAutoGeneratedDomainNameLabelScope
The value representing the security enum.
The 'Unsecure' value is the default value if not selected and means the object's domain name label is not secured against subdomain takeover.
The 'TenantReuse' value is the default value if selected and means the object's domain name label can be reused within the same tenant.
The 'SubscriptionReuse' value means the object's domain name label can be reused within the same subscription.
The 'ResourceGroupReuse' value means the object's domain name label can be reused within the same resource group.
The 'NoReuse' value means the object's domain name label cannot be reused within the same resource group, subscription, or tenant.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-IPAddressDnsNameLabel
The Dns name label for the IP.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-IPAddressIP
The IP exposed to the public internet.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-IPAddressPort
The list of ports exposed on the container group.
To construct, see NOTES section for IPADDRESSPORT properties and create a hash table.
Parameter properties
Type: IPort [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-IPAddressType
Specifies if the IP is exposed to the public internet or private VNET.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Location
The resource location.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-LogAnalyticLogType
The log type to be used.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
Metadata for log analytics.
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-LogAnalyticWorkspaceId
The workspace id for log analytics
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-LogAnalyticWorkspaceKey
The workspace key for log analytics
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-LogAnalyticWorkspaceResourceId
The workspace resource id for log analytics
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Name
The name of the container group profile.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: ContainerGroupProfileName
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-OSType
The operating system type required by the containers in the container group.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Priority
The priority of the container group.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
The name of the resource group.
The name is case insensitive.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-RestartPolicy
Restart policy for all containers within the container group.
Always
Always restart- OnFailure
Restart on failure- Never
Never restart
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Sku
The SKU for a container group.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SubscriptionId
The ID of the target subscription.
The value must be an UUID.
Parameter properties
Type: String
Default value: (Get-AzContext).Subscription.Id
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Tag
The resource tags.
Parameter properties
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Volume
The list of volumes that can be mounted by containers in this container group.
To construct, see NOTES section for VOLUME properties and create a hash table.
Parameter properties
Type: IVolume [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Zone
The zones for the container group.
Parameter properties
Type: String [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs