https://pulumi.com logo
#azure
Title
# azure
b

billowy-tiger-6272

11/17/2022, 3:08 AM
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

icy-doctor-13719

11/17/2022, 3:24 PM
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

billowy-tiger-6272

11/17/2022, 6:14 PM
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

icy-doctor-13719

11/17/2022, 6:14 PM
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

billowy-tiger-6272

11/17/2022, 6:18 PM
Ahhh, I see! Thanks a lot for your help! 😉
3 Views