https://pulumi.com logo
l

little-orange-65618

05/05/2021, 8:53 AM
Interesting, I'd been passing along subscription variables for creating resources in multiple subscriptions but it appears like azure-native.resources.ResourceGroup doesn't support a subscription input so everything ended up in what I assume is set via my az cli (ARM_SUBSCRIPTION_ID). Is there a way to handle that elegantly (One API call -> One Pulumi Inline Program Run -> Resources in 2+ Subscriptions)? Can I swap the pulumi config back and forth every-time I go to create a resource?
to clarify, the purpose is we have separate subscriptions per region (NA / Europe) for regulatory compliance
What I'm trying to avoid is having two program runs be necessary (one for each subscription)
l

lemon-agent-27707

05/05/2021, 1:45 PM
You can use an explicit provider to control which account resources get created in: https://www.pulumi.com/docs/reference/pkg/azure/provider/
l

little-orange-65618

05/05/2021, 3:52 PM
interesting so create ProviderA that's set to Sub A, B->B and pass them in the ResourceOptions
đź‘Ť 1
i'll give that a shot
@lemon-agent-27707 do I need to run it as a service principal to make the provider work like that?
l

lemon-agent-27707

05/06/2021, 12:28 AM
I am unsure on the exact details of configuring the azure provider. @tall-librarian-49374 might know, also a good question for the #azure channel.
t

tall-librarian-49374

05/06/2021, 6:11 AM
do I need to run it as a service principal to make the provider work like that?
No, you shouldn’t need that.
l

little-orange-65618

05/10/2021, 3:51 PM
@tall-librarian-49374 any idea why after specifying (provider=MySubscriptionProvider) I'm seeing error messages indicating it's using the azure CLI?
Copy code
+  pulumi:pulumi:Stack SDP-cinsights-dual creating
+  pulumi:providers:azure-native amap_provider creating
+  pulumi:providers:azure-native amap_provider created
+  pulumi:providers:azure-native emea_provider creating
azure-native:resources:ResourceGroup cinsights-dual-amap-rg  error: building auth config: obtain subscription(...) from Azure CLI: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1
+  pulumi:providers:azure-native emea_provider created