Is there anu example of the Azure Native Provider ...
# azure
b
Is there anu example of the Azure Native Provider resouce about how it is used in a Pulumi project? https://www.pulumi.com/registry/packages/azure-native/installation-configuration/#create-your-service-principal-and-get-your-tokens
i
Here’s how I use it:
Copy code
var provider = new Pulumi.AzureNative.Provider("provider", new Pulumi.AzureNative.ProviderArgs()
        {
            SubscriptionId = p.subscriptionId,
            ClientId = p.servicePrincipalId,
            ClientSecret = p.servicePrincipalSecret,
            TenantId = p.tenantId,
            PartnerId = p.partnerId
        });

        // Azure Resource Group
        var rg = new Pulumi.AzureNative.Resources.ResourceGroup("rg", new()
        {
            ResourceGroupName = $"rg-{p.projectName}-{p.env}",
            Location = p.location,
            Tags = { { "env", p.env } }
        }, new CustomResourceOptions() { Provider = provider });
b
Hey @icy-doctor-13719, thanks for the reply!! Just one thing: is it enough to assign it the Resource Group or do I need to set it in every other resource I create?
i
resource group is good enough
if you have other resources that aren’t tied to that resource group, you can always assign them a different provider … i.e. I have Azure DNS in another subscription/rg and I want to manage DNS records there so I have a separate provider
b
Ahhh, I see! Thanks a lot for your help! 😉