Azure / Azure/azure-powershell
Get-AzureRmVM -Status does not work within workflow
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
### Script/Steps for Reproduction
1) created Runbook of type workflow in Azure Automation
2) added command
```powershell
Select-AzureRMSubscription -SubscriptionName $SubscriptionName # put your name
$ResourceGroups = @()
$ResourceGroups += "YourResourceGroupName"
ForEach -parallel ($RGName in $ResourceGroups) {
$VMs = Get-AzureRmVM -ResourceGroupName $RGName -Status
}
```
It returns error
### Module Version
Version - 5.2.0
### Environment Data
```powershell
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.16299.98
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.98
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```
### Debug Output
# Here is the error output
```
Get-AzureRmVM : Missing type map configuration or unsupported mapping.
Mapping types:
AzureOperationResponse`1 -> PSVirtualMachineListStatus
Microsoft.Rest.Azure.AzureOperationResponse`1[[Microsoft.Rest.Azure.IPage`1[[Microsoft.Azure.Management.Compute.Models.V
irtualMachine, Microsoft.Azure.Management.Compute, Version=15.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]], Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]] -> Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineListStatus
Destination path:
PSVirtualMachineListStatus
Source value:
Microsoft.Rest.Azure.AzureOperationResponse`1[Microsoft.Rest.Azure.IPage`1[Microsoft.Azure.Management.Compute.Models.Vir
tualMachine]]
At GaryTest:78 char:78
+
+ CategoryInfo : CloseError: (:) [Get-AzureRmVM], AutoMapperMappingException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.GetAzureVMCommand
Get-AzureRmVM : Missing type map configuration or unsupported mapping.
Mapping types:
AzureOperationResponse`1 -> PSVirtualMachineListStatus
Microsoft.Rest.Azure.AzureOperationResponse`1[[Microsoft.Rest.Azure.IPage`1[[Microsoft.Azure.Management.Compute.Models.V
irtualMachine, Microsoft.Azure.Management.Compute, Version=15.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]], Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]] -> Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineListStatus
Destination path:
PSVirtualMachineListStatus
Source value:
Microsoft.Rest.Azure.AzureOperationResponse`1[Microsoft.Rest.Azure.IPage`1[Microsoft.Azure.Management.Compute.Models.Vir
tualMachine]]
At GaryTest:78 char:78
+
+ CategoryInfo : CloseError: (:) [Get-AzureRmVM], AutoMapperMappingException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.GetAzureVMCommand
Get-AzureRmVM : Missing type map configuration or unsupported mapping.
Mapping types:
AzureOperationResponse`1 -> PSVirtualMachineListStatus
Microsoft.Rest.Azure.AzureOperationResponse`1[[Microsoft.Rest.Azure.IPage`1[[Microsoft.Azure.Management.Compute.Models.V
irtualMachine, Microsoft.Azure.Management.Compute, Version=15.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]], Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]] -> Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineListStatus
Destination path:
PSVirtualMachineListStatus
Source value:
Microsoft.Rest.Azure.AzureOperationResponse`1[Microsoft.Rest.Azure.IPage`1[Microsoft.Azure.Management.Compute.Models.Vir
tualMachine]]
At GaryTest:78 char:78
+
+ CategoryInfo : CloseError: (:) [Get-AzureRmVM], AutoMapperMappingException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.GetAzureVMCommand
Runbooks-Info-Creating new runbook
Edit PowerShell Workflow Runbook*-Info-Saving the runbook
Test-Info-Submitting request to test the runbook.
```
Contributor guide
Assessment
This issue has not been assessed yet.