Sep 19 2020 08:37 PM
I am trying to utilise 'foreach -Parallel' to perform processing across multiple subscriptions however I've noticed that 'parallel' uses the same 'PSSourceJobInstanceId' as the workflow therefore only supports one subscription context at a time.
Is there a work-around for this or do Azure Automation workflows not support 'Parallel' across subscription contexts?
Code example;
}
Output;
* With -Parallel
PSComputerName : localhost
PSSourceJobInstanceId : 2b5feb08-dadb-4b21-a689-aa94f169095b
Name : NonProd (ccd47b39-###) - ### - ###
Account : ###
Environment : AzureCloud
Subscription : ccd47b39-###
Tenant : ###
TokenCache : Microsoft.Azure.Commands.Common.Authentication.Core.ProtectedFileTokenCache
VersionProfile :
ExtendedProperties : {}
PSComputerName : localhost
Total VMs - 98
PSSourceJobInstanceId : 2b5feb08-dadb-4b21-a689-aa94f169095b
Name : Prod (ec5f9429-###) - ### - ###
Account : ###
Environment : AzureCloud
Subscription : ec5f9429-###
Tenant : ###
TokenCache : Microsoft.Azure.Commands.Common.Authentication.Core.ProtectedFileTokenCache
VersionProfile :
ExtendedProperties : {}
Total VMs - 98
* Without -Parallel
PSComputerName : localhost
PSSourceJobInstanceId : 2b5feb08-dadb-4b21-a689-aa94f169095b
Name : Prod (ec5f9429-###) - ### - ###
Account : ###
Environment : AzureCloud
Subscription : ec5f9429-###
Tenant : ###
TokenCache : Microsoft.Azure.Commands.Common.Authentication.Core.ProtectedFileTokenCache
VersionProfile :
ExtendedProperties : {}
Total VMs - 98
PSComputerName : localhost
PSSourceJobInstanceId : 2b5feb08-dadb-4b21-a689-aa94f169095b
Name : NonProd (ccd47b39-###) - ### - ###
Account : ###
Environment : AzureCloud
Subscription : ccd47b39-###
Tenant : ###
TokenCache : Microsoft.Azure.Commands.Common.Authentication.Core.ProtectedFileTokenCache
VersionProfile :
ExtendedProperties : {}
Total VMs - 31
Also tried using a 'runspace' withing the 'foreach -Parallel' however this made no difference;
Thanks in advance.
Paul