Pulumi Azure Native

3.16.0 · active · verified Mon Apr 13

Pulumi Azure Native is a Pulumi provider that enables users to manage Azure resources directly from the Azure Resource Manager (ARM) API. It offers complete coverage of Azure resources and is updated frequently, often with new features and schema changes. The current version is 3.16.0, with releases occurring roughly every 2-4 weeks.

Warnings

Install

Imports

Quickstart

This quickstart deploys an Azure Resource Group and a Storage Account using `pulumi-azure-native`. Ensure you have Pulumi CLI installed, Azure CLI logged in (`az login`), and set a default Azure location (`pulumi config set azure-native:location eastus`). The `stack_suffix` is used to ensure globally unique names for resources like storage accounts.

import pulumi
import pulumi_azure_native as azure_native
import os

# Pulumi requires Azure credentials to be configured (e.g., via `az login` or environment variables).
# The Azure location is usually set via `pulumi config set azure-native:location eastus`.

# Define a unique suffix for resource names to avoid conflicts
# In a real project, this might come from pulumi.StackReference or config.
stack_suffix = os.environ.get("PULUMI_STACK_SUFFIX", "dev").lower()

# Create an Azure Resource Group
resource_group = azure_native.resources.ResourceGroup("my-resource-group",
    resource_group_name=f"my-pulumi-rg-{stack_suffix}",
    location="EastUS") # Location often configured globally via 'pulumi config set azure-native:location'

# Create an Azure Storage Account
# Note: Storage account names must be globally unique and lowercase.
storage_account = azure_native.storage.StorageAccount("mystorageaccount",
    resource_group_name=resource_group.name, # Pulumi automatically unwraps output properties
    account_name=f"mypulumiaccount{stack_suffix}123",
    location=resource_group.location,
    sku=azure_native.storage.SkuArgs(name="Standard_LRS"),
    kind="StorageV2")

pulumi.export("resource_group_name", resource_group.name)
pulumi.export("storage_account_name", storage_account.name)
pulumi.export("storage_account_primary_blob_endpoint", storage_account.primary_endpoints.apply(lambda endpoints: endpoints.blob))

view raw JSON →