- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.1k
Closed
Labels
Container InstancesContains Breaking ChangeThis PR contains breaking changeThis PR contains breaking changecustomer-reportedfeature-requestThis issue requires a new behavior in the product in order be resolved.This issue requires a new behavior in the product in order be resolved.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Description
Description
Scenario: Execute a command within an Azure Container Instances container.
By using Azure CLI, this works as expected:
PS /> az container exec --resource-group test-rg --name test-aci-01 --container-name container-01 --exec-command "date"
Thu Aug 26 04:14:18 UTC 2021
When trying to accomplish the same using Azure PowerShell, the output is not the command output - but rather a password and a websocket URI as shown below. Could it be that the Azure CLI uses these credentials to actually gather the command output, but the PowerShell command does not? If so, it would be useful if this behaviour could be change similarly to Azure CLI.
Also, it is unclear why we in the PowerShell command need to specify -TerminalSizeCol and -TerminalSizeRow, while in the Azure CLI option we do not.
Steps to reproduce
PS /> Invoke-AzContainerInstanceCommand -ResourceGroupName test-rg -ContainerGroupName test-aci-01 -ContainerName container-01 -Command "date" -TerminalSizeCol 12 -TerminalSizeRow 12
Password                         WebSocketUri
--------                         ------------
random-string wss://abc123.norwayeast.atlas.cloudapp.azure.com:19390/execstream/sessionId/80035cbc-85e8-4fec-a0af-Environment data
PS /> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Linux 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Module versions
ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.5.2                 Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount…}
Script     2.1.0                 Az.ContainerInstance                {Add-AzContainerInstanceOutput, Get-AzContainerGroup, Get-AzContainerInstan…Debug output
DEBUG: 06:20:55 - GetAzureRMContextCommand end processing.
DEBUG: [CmdletBeginProcessing]: Starting command
DEBUG: CmdletBeginProcessing:
DEBUG: CmdletProcessRecordStart:
DEBUG: [CmdletProcessRecordAsyncStart]: Created new QosEvent for command 'Invoke-AzContainerInstanceCommand_ExecuteExpanded'
DEBUG: CmdletProcessRecordAsyncStart:
DEBUG: CmdletGetPipeline:
DEBUG: CmdletBeforeAPICall:
DEBUG: URLCreated: /subscriptions/1234b02e-f8fd-40bd-8b6a-ed7f52778fbd/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/aci-01/containers/container-01/exec?api-version=2021-03-01
DEBUG: RequestCreated: /subscriptions/1234b02e-f8fd-40bd-8b6a-ed7f52778fbd/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/aci-01/containers/container-01/exec?api-version=2021-03-01
DEBUG: HeaderParametersAdded:
DEBUG: BodyContentSet:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://management.azure.com/subscriptions/1234b02e-f8fd-40bd-8b6a-ed7f52778fbd/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/aci-01/containers/container-01/exec?api-version=2021-03-01
Headers:
x-ms-unique-id                : 2
x-ms-client-request-id        : 410e0c1b-657c-4a36-ba9c-3eaff7d4a6a3
CommandName                   : Az.ContainerInstance.internal\Invoke-AzContainerInstanceCommand
FullCommandName               : Invoke-AzContainerInstanceCommand_ExecuteExpanded
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/Az4.0.0-preview
Body:
{
  "terminalSize": {
    "rows": 12,
    "cols": 12
  },
  "command": "date"
}
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Vary                          : Accept-Encoding
x-ms-request-id               : norwayeast:6423ba08-f3cf-47dd-923f-e100ceab4dd5
x-ms-ratelimit-remaining-subscription-writes: 1198
x-ms-correlation-request-id   : 708d1e3d-aed9-44c7-b61c-65916bc994df
x-ms-routing-request-id       : GERMANYNORTH:20210826T042057Z:708d1e3d-aed9-44c7-b61c-65916bc994df
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Thu, 26 Aug 2021 04:20:56 GMT
Body:
{
  "webSocketUri": "wss://randomized.norwayeast.atlas.cloudapp.azure.com:19390/execstream/sessionId/871eacb5-aa1b-4f90-8b56-7eeadc0fd603?api-version=1.0&rows=12&cols=12",
  "password": "removed"
}
DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.ContainerInstance:2.1.0.0; CommandName: Invoke-AzContainerInstanceCommand_ExecuteExpanded; PSVersion: ; IsSuccess: True; Duration: 00:00:00
DEBUG: Finish sending metric.
DEBUG: CmdletEndProcessing:
Error output
N/A
Metadata
Metadata
Assignees
Labels
Container InstancesContains Breaking ChangeThis PR contains breaking changeThis PR contains breaking changecustomer-reportedfeature-requestThis issue requires a new behavior in the product in order be resolved.This issue requires a new behavior in the product in order be resolved.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that