Skip to content

Invoke-AzureRmVMRunCommand returns empty #5982

@mcocak

Description

@mcocak

Description

Invoke-AzureRmVMRunCommand started returning empty after execution. Until last week, the command printed the stdout of the remotely executed command on the VM. However, it is now returning empty string.

As you see in the debug output below, I'm executing a basic "docker ps" command on the remote Linux VM. The command is for sure executed remotely and the output of the command is visible in the HTTP response from Azure, however, Invoke-AzureRmVMRunCommand output is empty.

Script/Steps for Reproduction

Invoke-AzureRmVMRunCommand -ResourceGroupName $resourceGroup -Name $vmName -CommandId 'RunShellScript' -ScriptPath $scriptFile

Module Version

Get-Module -Name AzureRM -ListAvailable
ModuleType Version    Name                                ExportedCommands                                                                      
---------- -------    ----                                ----------------                                                                      
Script     0.11.0     AzureRM.Aks.Netcore                 {Get-AzureRmAks, New-AzureRmAks, Remove-AzureRmAks, Import-AzureRmAksCredential...}   
Script     0.11.0     AzureRM.AnalysisServices.Netcore    {Resume-AzureRmAnalysisServicesServer, Suspend-AzureRmAnalysisServicesServer, Get-A...
Script     0.11.0     AzureRM.ApiManagement.Netcore       {Add-AzureRmApiManagementRegion, Get-AzureRmApiManagementSsoToken, New-AzureRmApiMa...
Script     0.11.0     AzureRM.ApplicationInsights.Netcore {Get-AzureRmApplicationInsights, New-AzureRmApplicationInsights, Remove-AzureRmAppl...
Script     0.11.0     AzureRM.Automation.Netcore          {Get-AzureRMAutomationHybridWorkerGroup, Get-AzureRmAutomationJobOutputRecord, Impo...
Script     0.11.0     AzureRM.Backup.Netcore              {Backup-AzureRmBackupItem, Enable-AzureRmBackupContainerReregistration, Get-AzureRm...
Script     0.11.0     AzureRM.Batch.Netcore               {Remove-AzureRmBatchAccount, Get-AzureRmBatchAccount, Get-AzureRmBatchAccountKeys, ...
Script     0.11.0     AzureRM.Billing.Netcore             {Get-AzureRmBillingInvoice, Get-AzureRmBillingPeriod, Get-AzureRmEnrollmentAccount}   
Script     0.11.0     AzureRM.Cdn.Netcore                 {Get-AzureRmCdnProfile, Get-AzureRmCdnProfileSsoUrl, New-AzureRmCdnProfile, Remove-...
Script     0.11.0     AzureRM.CognitiveServices.Netcore   {Get-AzureRmCognitiveServicesAccount, Get-AzureRmCognitiveServicesAccountKey, Get-A...
Script     0.11.0     AzureRM.Compute.Netcore             {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet, New-AzureRmAvailability...
Script     0.10.0     AzureRM.Compute.Netcore             {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet, New-AzureRmAvailability...
Script     0.11.0     AzureRM.Consumption.Netcore         Get-AzureRmConsumptionUsageDetail                                                     
Script     0.11.0     AzureRM.ContainerInstance.Netcore   {New-AzureRmContainerGroup, Get-AzureRmContainerGroup, Remove-AzureRmContainerGroup...
Script     0.11.0     AzureRM.ContainerRegistry.Netcore   {New-AzureRmContainerRegistry, Get-AzureRmContainerRegistry, Update-AzureRmContaine...
Script     0.11.0     AzureRM.DataFactories.Netcore       {Remove-AzureRmDataFactory, Get-AzureRmDataFactoryRun, Get-AzureRmDataFactorySlice,...
Script     0.11.0     AzureRM.DataFactoryV2.Netcore       {Set-AzureRmDataFactoryV2, Update-AzureRmDataFactoryV2, Get-AzureRmDataFactoryV2, R...
Script     0.11.0     AzureRM.DataLakeAnalytics.Netcore   {Get-AzureRmDataLakeAnalyticsDataSource, New-AzureRmDataLakeAnalyticsCatalogCredent...
Script     0.11.0     AzureRM.DataLakeStore.Netcore       {Get-AzureRmDataLakeStoreTrustedIdProvider, Remove-AzureRmDataLakeStoreTrustedIdPro...
Script     0.11.0     AzureRM.DevTestLabs.Netcore         {Get-AzureRmDtlAllowedVMSizesPolicy, Get-AzureRmDtlAutoShutdownPolicy, Get-AzureRmD...
Script     0.11.0     AzureRM.Dns.Netcore                 {Get-AzureRmDnsRecordSet, New-AzureRmDnsRecordConfig, Remove-AzureRmDnsRecordSet, S...
Script     0.11.0     AzureRM.EventGrid.Netcore           {New-AzureRmEventGridTopic, Get-AzureRmEventGridTopic, Set-AzureRmEventGridTopic, N...
Script     0.11.0     AzureRM.EventHub.Netcore            {New-AzureRmEventHubNamespace, Get-AzureRmEventHubNamespace, Set-AzureRmEventHubNam...
Script     0.11.0     AzureRM.Insights.Netcore            {Get-AzureRmMetricDefinition, Get-AzureRmMetric, Remove-AzureRmLogProfile, Get-Azur...
Script     0.11.0     AzureRM.IotHub.Netcore              {Add-AzureRmIotHubKey, Get-AzureRmIotHubEventHubConsumerGroup, Get-AzureRmIotHubCon...
Script     0.11.0     AzureRM.KeyVault.Netcore            {Add-AzureKeyVaultCertificate, Set-AzureKeyVaultCertificateAttribute, Stop-AzureKey...
Script     0.10.0     AzureRM.KeyVault.Netcore            {Add-AzureKeyVaultCertificate, Set-AzureKeyVaultCertificateAttribute, Stop-AzureKey...
Script     0.11.0     AzureRM.LogicApp.Netcore            {Get-AzureRmIntegrationAccountAgreement, Get-AzureRmIntegrationAccountCallbackUrl, ...
Script     0.11.0     AzureRM.MachineLearning.Netcore     {Move-AzureRmMlCommitmentAssociation, Get-AzureRmMlCommitmentAssociation, Get-Azure...
Script     0.11.0     AzureRM.MachineLearningCompute.N... {Get-AzureRmMlOpCluster, Get-AzureRmMlOpClusterKey, Test-AzureRmMlOpClusterSystemSe...
Script     0.11.0     AzureRM.MarketplaceOrdering.Netcore {Get-AzureRmMarketplaceTerms, Set-AzureRmMarketplaceTerms}                            
Script     0.11.0     AzureRM.Media.Netcore               {Sync-AzureRmMediaServiceStorageKeys, Set-AzureRmMediaServiceKey, Get-AzureRmMediaS...
Script     0.11.0     AzureRM.Netcore                                                                                                           
Manifest   0.10.0     AzureRM.Netcore                                                                                                           
Script     0.11.0     AzureRM.Network.Netcore             {Add-AzureRmApplicationGatewayAuthenticationCertificate, Get-AzureRmApplicationGate...
Script     0.10.0     AzureRM.Network.Netcore             {Add-AzureRmApplicationGatewayAuthenticationCertificate, Get-AzureRmApplicationGate...
Script     0.11.0     AzureRM.NotificationHubs.Netcore    {Get-AzureRmNotificationHub, Get-AzureRmNotificationHubAuthorizationRules, Get-Azur...
Script     0.11.0     AzureRM.OperationalInsights.Netcore {New-AzureRmOperationalInsightsAzureActivityLogDataSource, New-AzureRmOperationalIn...
Script     0.11.0     AzureRM.PowerBIEmbedded.Netcore     {Remove-AzureRmPowerBIWorkspaceCollection, Get-AzureRmPowerBIWorkspaceCollection, G...
Script     0.11.0     AzureRM.Profile.Netcore             {Disable-AzureRmDataCollection, Disable-AzureRmContextAutosave, Enable-AzureRmDataC...
Script     0.10.0     AzureRM.Profile.Netcore             {Disable-AzureRmDataCollection, Disable-AzureRmContextAutosave, Enable-AzureRmDataC...
Script     0.11.0     AzureRM.RedisCache.Netcore          {Remove-AzureRmRedisCachePatchSchedule, New-AzureRmRedisCacheScheduleEntry, Get-Azu...
Script     0.11.0     AzureRM.Relay.Netcore               {New-AzureRmRelayNamespace, Get-AzureRmRelayNamespace, Set-AzureRmRelayNamespace, R...
Script     0.11.0     AzureRM.Resources.Netcore           {Get-AzureRmProviderOperation, Remove-AzureRmRoleAssignment, Get-AzureRmRoleAssignm...
Script     0.10.0     AzureRM.Resources.Netcore           {Get-AzureRmProviderOperation, Remove-AzureRmRoleAssignment, Get-AzureRmRoleAssignm...
Script     0.11.0     AzureRM.Scheduler.Netcore           {Disable-AzureRmSchedulerJobCollection, Enable-AzureRmSchedulerJobCollection, Get-A...
Script     0.11.0     AzureRM.ServiceBus.Netcore          {New-AzureRmServiceBusNamespace, Get-AzureRmServiceBusNamespace, Set-AzureRmService...
Script     0.11.0     AzureRM.ServiceFabric.Netcore       {Add-AzureRmServiceFabricApplicationCertificate, Add-AzureRmServiceFabricClientCert...
Script     0.11.0     AzureRM.Sql.Netcore                 {Get-AzureRmSqlDatabaseTransparentDataEncryption, Get-AzureRmSqlDatabaseTransparent...
Script     0.11.0     AzureRM.Storage.Netcore             {Get-AzureRmStorageAccount, Get-AzureRmStorageAccountKey, New-AzureRmStorageAccount...
Script     0.10.0     AzureRM.Storage.Netcore             {Get-AzureRmStorageAccount, Get-AzureRmStorageAccountKey, New-AzureRmStorageAccount...
Script     0.11.0     AzureRM.StreamAnalytics.Netcore     {Get-AzureRmStreamAnalyticsFunction, Get-AzureRmStreamAnalyticsDefaultFunctionDefin...
Script     0.11.0     AzureRM.Tags.Netcore                {Remove-AzureRmTag, Get-AzureRmTag, New-AzureRmTag}                                   
Script     0.10.0     AzureRM.Tags.Netcore                {Remove-AzureRmTag, Get-AzureRmTag, New-AzureRmTag}                                   
Script     0.11.0     AzureRM.TrafficManager.Netcore      {Disable-AzureRmTrafficManagerEndpoint, Enable-AzureRmTrafficManagerEndpoint, Set-A...
Script     0.11.0     AzureRM.UsageAggregates.Netcore     Get-UsageAggregates                                                                   
Script     0.11.0     AzureRM.Websites.Netcore            {Get-AzureRmAppServicePlan, Set-AzureRmAppServicePlan, New-AzureRmAppServicePlan, R...
Script     0.10.0     AzureRM.Websites.Netcore            {Get-AzureRmAppServicePlan, Set-AzureRmAppServicePlan, New-AzureRmAppServicePlan, R...

Environment Data

$PSVersionTable
Name                           Value                                                                                                            
----                           -----                                                                                                            
PSVersion                      6.0.2                                                                                                            
PSEdition                      Core                                                                                                             
GitCommitId                    v6.0.2                                                                                                           
OS                             Darwin 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64    
Platform                       Unix                                                                                                             
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                          
PSRemotingProtocolVersion      2.3                                                                                                              
SerializationVersion           1.1.0.1                                                                                                          
WSManStackVersion              3.0

Debug Output

DEBUG: 15:42:33 - InvokeAzureRmVMRunCommand begin processing with ParameterSet 'DefaultParameter'.
DEBUG: 15:42:33 - using account id 'REMOVED_AS_SENSITIVE'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'REMOVED_AS_SENSITIVE', environment: 'AzureCloud', tenant: 'REMOVED_AS_SENSITIVE'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
REMOVED_AS_SENSITIVE

Headers:
x-ms-client-request-id        : REMOVED_AS_SENSITIVE
accept-language               : en-US

Body:
{
  "commandId": "RunShellScript",
  "script": [
    "docker ps"
  ]
}


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
Accepted

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Location                      : REMOVED_AS_SENSITIVE
Azure-AsyncOperation          : REMOVED_AS_SENSITIVE
x-ms-ratelimit-remaining-resource: Microsoft.Compute/UpdateVM3Min;239,Microsoft.Compute/UpdateVM30Min;1192
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-served-by                : REMOVED_AS_SENSITIVE
x-ms-request-id               : REMOVED_AS_SENSITIVE
x-ms-ratelimit-remaining-subscription-writes: 1199
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-correlation-request-id   : REMOVED_AS_SENSITIVE
x-ms-routing-request-id       : REMOVED_AS_SENSITIVE
X-Content-Type-Options        : nosniff
Date                          : Wed, 18 Apr 2018 12:42:33 GMT

Body:



DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
REMOVED_AS_SENSITIVE

Headers:

Body:



DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-ratelimit-remaining-resource: Microsoft.Compute/GetOperation3Min;14998,Microsoft.Compute/GetOperation30Min;29976
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-served-by                : REMOVED_AS_SENSITIVE
x-ms-request-id               : REMOVED_AS_SENSITIVE
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 14998
x-ms-correlation-request-id   : REMOVED_AS_SENSITIVE
x-ms-routing-request-id       : REMOVED_AS_SENSITIVE
X-Content-Type-Options        : nosniff
Date                          : Wed, 18 Apr 2018 12:43:03 GMT

Body:
{
  "startTime": "2018-04-18T15:42:33.7502021+03:00",
  "endTime": "2018-04-18T15:42:48.6877604+03:00",
  "status": "Succeeded",
  "properties": {
    "output": [
      {
        "code": "ProvisioningState/succeeded",
        "level": "Info",
        "displayStatus": "Provisioning succeeded",
        "message": "Enable succeeded: \n[stdout]\nCONTAINER ID        IMAGE                                               COMMAND              CREATED             STATUS                 PORTS               NAMES\nREMOVED_AS_SENSITIVE   \"/something.sh\"   2 hours ago         Up 2 hours (healthy)                       something\n\n[stderr]\n"
      }
    ]
  },
  "name": "REMOVED_AS_SENSITIVE"
}


DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
REMOVED_AS_SENSITIVE

Headers:

Body:



DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-ratelimit-remaining-resource: Microsoft.Compute/GetOperation3Min;14997,Microsoft.Compute/GetOperation30Min;29975
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-served-by                : REMOVED_AS_SENSITIVE
x-ms-request-id               : REMOVED_AS_SENSITIVE
Server                        : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 14997
x-ms-correlation-request-id   : REMOVED_AS_SENSITIVE
x-ms-routing-request-id       : REMOVED_AS_SENSITIVE
X-Content-Type-Options        : nosniff
Date                          : Wed, 18 Apr 2018 12:43:03 GMT

Body:
[{"code":"ProvisioningState/succeeded","level":"Info","displayStatus":"Provisioning succeeded","message":"Enable succeeded: \n[stdout]\nCONTAINER ID        IMAGE                                               COMMAND              CREATED             STATUS                 PORTS               NAMES\nREMOVED_AS_SENSITIVE   \"/something.sh\"   2 hours ago         Up 2 hours (healthy)                       something\n\n[stderr]\n"}]





DEBUG: AzureQoSEvent: CommandName - Invoke-AzureRmVMRunCommand; IsSuccess - True; Duration - 00:00:31.1142970; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 15:43:04 - InvokeAzureRmVMRunCommand end processing.
DEBUG: 15:43:04 - InvokeAzureRmVMRunCommand end processing.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions