0

I have 2 Azure Subscriptions(say Subscription A & B) already created, service principal is also configured. I want to configure diagnostics in Subscription A so that I can send data to a workspace in Subscription B. I'm using Pulumi as IaC tool, how can I achieve this using Pulumi Native Azure API?

All I could find was this module: https://www.pulumi.com/registry/packages/azure-native/api-docs/provider/ however it doesn't let you call any functions such as 'get_workspace'.

Any suggestions?

Using Pulumi version v3.55.0 and Pulumi Azure Native.

Amrit
  • 2,295
  • 4
  • 25
  • 42

1 Answers1

1

When we create a new Pulumi Azure project, it will use the default Azure provider and deploy resources into either whatever subscription you have selected in the CLI when you run it or explicitly set the subscription ID using an environment variable it will use that. We don’t need to create a provider object for this; Pulumi does it for us.

If we want to deploy some resources to a second subscription, we need to create a new Pulumi Azure provider in our code that provides details of that subscription. Once we do that, we can then use that provider for our specific resources.

Source: https://samcogan.com/deploying-to-more-than-one-azure-subscription-with-pulumi/

In Python, there's option to provide alternate provider using:

provider = Provider("provider", region="us-west-2")
vpc = ec2.Vpc("vpc", opts=ResourceOptions(provider=provider))

For my particular issue, additional provider can be specified by using:

opts=pulumi.InvokeOptions(provider=provider)

def get_workspace(resource_group_name: Optional[str] = None,
                  workspace_name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetWorkspaceResult

Source: https://www.pulumi.com/docs/intro/concepts/resources/options/provider/

Amrit
  • 2,295
  • 4
  • 25
  • 42