Editar

Compartilhar via


Invoke-AzContainerInstanceCommand

Executes a command for a specific container instance in a specified resource group and container group.

Syntax

Invoke-AzContainerInstanceCommand
      -ContainerGroupName <String>
      -ContainerName <String>
      -ResourceGroupName <String>
      [-SubscriptionId <String>]
      -Command <String>
      [-TerminalSizeCol <Int32>]
      [-TerminalSizeRow <Int32>]
      [-DefaultProfile <PSObject>]
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Executes a command for a specific container instance in a specified resource group and container group.

Examples

Example 1: Execute a command in a specific container instance

Invoke-AzContainerInstanceCommand -ContainerGroupName test-cg -ContainerName test-container -ResourceGroupName test-rg -Command "echo hello"

hello

Executes command "echo hello" in a container instance test-container.

Parameters

-Command

The command to be executed.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ContainerGroupName

The name of the container group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ContainerName

The name of the container instance.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Returns last execution result when the command succeeds. By default the cmdlet returns nothing.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TerminalSizeCol

The column size of the terminal

Type:Int32
Position:Named
Default value:$host.UI.RawUI.WindowSize.Width
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TerminalSizeRow

The row size of the terminal

Type:Int32
Position:Named
Default value:$host.UI.RawUI.WindowSize.Height
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

String