https://pulumi.com logo
#python
Title
# python
k

kind-afternoon-60990

07/06/2023, 6:20 AM
Hi, I am new to pulumi and I want to use it with python since my team will have it easier to adapt since we use python in a lot other places. I want to create a small tool that reads secrets from an Azure KeyVault and copies them to other KeyVaults. That alone is quite easy but the challenge is that the KeyVaults are in different subscriptions. I was thinking of adapting https://samcogan.com/deploying-to-more-than-one-azure-subscription-with-pulumi/ but I have a hard time to get anything running. Any ideas how I can create (custom) Provider so I can freely pass the subscription as input? The credentials are not important since the principal behind it got permissions to all related subscriptions/keyvaults.
I was thinking of something like
azure_provider = pulumi_azure_native.Provider("provider", subscription_id=subscription_id)
not sure if #azure is a better place to ask for that
I got it. Just me being not able to read properly caused a lot of wasted time 🙂
Copy code
subscription_id = "..."
azure_provider = pulumi_azure_native.Provider("provider", subscription_id=subscription_id)
rg_name = "..."
resource_group_resources = pulumi.Output.from_input(
    pulumi_azure_native.resources.get_resource_group(resource_group_name=rg_name, opts=pulumi.InvokeOptions(provider=azure_provider))
)
Is all that is needed to read some resource in a particular subscription. I wasted a lot time because I always tried ResourceOptions instead of InvokeOptions 😕