Module core

This provider is a derived work of the Terraform Provider distributed under MPL 2.0. If you encounter a bug or missing feature, first check the pulumi/pulumi-azure repo; however, if that doesn’t turn up anything, please consult the source terraform-providers/terraform-provider-azurerm repo.

Resources

Data Sources

Others

Resources

Resource ResourceGroup

class ResourceGroup extends CustomResource

Manages a resource group on Azure.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    location: "West US",
    tags: {
        environment: "Production",
    },
});

This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/resource_group.html.markdown.

constructor

new ResourceGroup(name: string, args?: ResourceGroupArgs, opts?: pulumi.CustomResourceOptions)

Create a ResourceGroup resource with the given unique name, arguments, and options.

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ResourceGroupState, opts?: pulumi.CustomResourceOptions): ResourceGroup

Get an existing ResourceGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

public static isInstance(obj: any): boolean

Returns true if the given object is an instance of ResourceGroup. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property location

public location: pulumi.Output<string>;

The location where the resource group should be created. For a list of all Azure locations, please consult this link or run az account list-locations --output table.

property name

public name: pulumi.Output<string>;

The name of the resource group. Must be unique on your Azure subscription.

property tags

public tags: pulumi.Output<{[key: string]: any}>;

A mapping of tags to assign to the resource.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

Resource TemplateDeployment

class TemplateDeployment extends CustomResource

Manages a template deployment of resources

Note on ARM Template Deployments: Due to the way the underlying Azure API is designed, this provider can only manage the deployment of the ARM Template - and not any resources which are created by it. This means that when deleting the azure.core.TemplateDeployment resource, this provider will only remove the reference to the deployment, whilst leaving any resources created by that ARM Template Deployment. One workaround for this is to use a unique Resource Group for each ARM Template Deployment, which means deleting the Resource Group would contain any resources created within it - however this isn’t ideal. More information.

Example Usage

Note: This example uses Storage Accounts and Public IP’s which are natively supported by this provider - we’d highly recommend using the Native Resources where possible instead rather than an ARM Template, for the reasons outlined above.

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("example", {
    location: "West US",
});
const exampleTemplateDeployment = new azure.core.TemplateDeployment("example", {
    deploymentMode: "Incremental",
    // these key-value pairs are passed into the ARM Template's `parameters` block
    parameters: {
        storageAccountType: "Standard_GRS",
    },
    resourceGroupName: exampleResourceGroup.name,
    templateBody: `{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "storageAccountType": {
      "type": "string",
      "defaultValue": "Standard_LRS",
      "allowedValues": [
        "Standard_LRS",
        "Standard_GRS",
        "Standard_ZRS"
      ],
      "metadata": {
        "description": "Storage Account type"
      }
    }
  },
  "variables": {
    "location": "[resourceGroup().location]",
    "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storage')]",
    "publicIPAddressName": "[concat('myPublicIp', uniquestring(resourceGroup().id))]",
    "publicIPAddressType": "Dynamic",
    "apiVersion": "2015-06-15",
    "dnsLabelPrefix": "example-acctest"
  },
  "resources": [
    {
      "type": "Microsoft.Storage/storageAccounts",
      "name": "[variables('storageAccountName')]",
      "apiVersion": "[variables('apiVersion')]",
      "location": "[variables('location')]",
      "properties": {
        "accountType": "[parameters('storageAccountType')]"
      }
    },
    {
      "type": "Microsoft.Network/publicIPAddresses",
      "apiVersion": "[variables('apiVersion')]",
      "name": "[variables('publicIPAddressName')]",
      "location": "[variables('location')]",
      "properties": {
        "publicIPAllocationMethod": "[variables('publicIPAddressType')]",
        "dnsSettings": {
          "domainNameLabel": "[variables('dnsLabelPrefix')]"
        }
      }
    }
  ],
  "outputs": {
    "storageAccountName": {
      "type": "string",
      "value": "[variables('storageAccountName')]"
    }
  }
}
`,
});

export const storageAccountName = exampleTemplateDeployment.outputs.apply(outputs => (<any>outputs)["storageAccountName"]);

Note

This provider does not know about the individual resources created by Azure using a deployment template and therefore cannot delete these resources during a destroy. Destroying a template deployment removes the associated deployment operations, but will not delete the Azure resources created by the deployment. In order to delete these resources, the containing resource group must also be destroyed. More information.

This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/template_deployment.html.markdown.

constructor

new TemplateDeployment(name: string, args: TemplateDeploymentArgs, opts?: pulumi.CustomResourceOptions)

Create a TemplateDeployment resource with the given unique name, arguments, and options.

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: TemplateDeploymentState, opts?: pulumi.CustomResourceOptions): TemplateDeployment

Get an existing TemplateDeployment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

public static isInstance(obj: any): boolean

Returns true if the given object is an instance of TemplateDeployment. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property deploymentMode

public deploymentMode: pulumi.Output<string>;

Specifies the mode that is used to deploy resources. This value could be either Incremental or Complete. Note that you will almost always want this to be set to Incremental otherwise the deployment will destroy all infrastructure not specified within the template, and this provider will not be aware of this.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property name

public name: pulumi.Output<string>;

Specifies the name of the template deployment. Changing this forces a new resource to be created.

property outputs

public outputs: pulumi.Output<{[key: string]: string}>;

A map of supported scalar output types returned from the deployment (currently, Azure Template Deployment outputs of type String, Int and Bool are supported, and are converted to strings - others will be ignored) and can be accessed using .outputs["name"].

property parameters

public parameters: pulumi.Output<{[key: string]: string} | undefined>;

Specifies the name and value pairs that define the deployment parameters for the template.

property parametersBody

public parametersBody: pulumi.Output<string | undefined>;

Specifies a valid Azure JSON parameters file that define the deployment parameters. It can contain KeyVault references

property resourceGroupName

public resourceGroupName: pulumi.Output<string>;

The name of the resource group in which to create the template deployment.

property templateBody

public templateBody: pulumi.Output<string>;

Specifies the JSON definition for the template.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

Data Sources

Data Source getClientConfig

getClientConfig(opts?: pulumi.InvokeOptions): Promise<GetClientConfigResult> & GetClientConfigResult

Use this data source to access the configuration of the AzureRM provider.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const current = azure.core.getClientConfig();

export const accountId = current.servicePrincipalApplicationId;

This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/d/client_config.html.markdown.

Data Source getResourceGroup

getResourceGroup(args: GetResourceGroupArgs, opts?: pulumi.InvokeOptions): Promise<GetResourceGroupResult> & GetResourceGroupResult

Use this data source to access information about an existing Resource Group.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = azure.core.getResourceGroup({
    name: "dsrgTest",
});
const exampleManagedDisk = new azure.compute.ManagedDisk("example", {
    createOption: "Empty",
    diskSizeGb: 1,
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    storageAccountType: "Standard_LRS",
});

This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/d/resource_group.html.markdown.

Data Source getResources

getResources(args?: GetResourcesArgs, opts?: pulumi.InvokeOptions): Promise<GetResourcesResult> & GetResourcesResult

Use this data source to access information about existing resources.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

// Get Resources with specific Tags
const example = azure.core.getResources({
    requiredTags: {
        environment: "production",
        role: "webserver",
    },
    resourceGroupName: "example-resources",
});

This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/d/resources.html.markdown.

Data Source getSubscription

getSubscription(args?: GetSubscriptionArgs, opts?: pulumi.InvokeOptions): Promise<GetSubscriptionResult> & GetSubscriptionResult

Use this data source to access information about an existing Subscription.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const current = azure.core.getSubscription();

export const currentSubscriptionDisplayName = current.displayName;

This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/d/subscription.html.markdown.

Data Source getSubscriptions

getSubscriptions(args?: GetSubscriptionsArgs, opts?: pulumi.InvokeOptions): Promise<GetSubscriptionsResult> & GetSubscriptionsResult

Use this data source to access information about all the Subscriptions currently available.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const available = azure.core.getSubscriptions();

export const availableSubscriptions = available.subscriptions;
export const firstAvailableSubscriptionDisplayName = available.subscriptions[0].displayName;

This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/d/subscriptions.html.markdown.

Data Source getUserAssignedIdentity

getUserAssignedIdentity(args: GetUserAssignedIdentityArgs, opts?: pulumi.InvokeOptions): Promise<GetUserAssignedIdentityResult> & GetUserAssignedIdentityResult

Use this data source to access information about an existing User Assigned Identity.

Example Usage (reference an existing)

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.authorization.getUserAssignedIdentity({
    name: "nameOfUserAssignedIdentity",
    resourceGroupName: "nameOfResourceGroup",
});

export const uaiClientId = example.clientId;
export const uaiPrincipalId = example.principalId;

This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/d/user_assigned_identity_legacy.html.markdown.

Others

interface GetClientConfigResult

interface GetClientConfigResult

A collection of values returned by getClientConfig.

property clientId

clientId: string;

property id

id: string;

id is the provider-assigned unique ID for this managed resource.

property objectId

objectId: string;

property servicePrincipalApplicationId

servicePrincipalApplicationId: string;

property servicePrincipalObjectId

servicePrincipalObjectId: string;

property subscriptionId

subscriptionId: string;

property tenantId

tenantId: string;

interface GetResourceGroupArgs

interface GetResourceGroupArgs

A collection of arguments for invoking getResourceGroup.

property name

name: string;

Specifies the name of the resource group.

interface GetResourceGroupResult

interface GetResourceGroupResult

A collection of values returned by getResourceGroup.

property id

id: string;

id is the provider-assigned unique ID for this managed resource.

property location

location: string;

The location of the resource group.

property name

name: string;

property tags

tags: {[key: string]: string};

A mapping of tags assigned to the resource group.

interface GetResourcesArgs

interface GetResourcesArgs

A collection of arguments for invoking getResources.

property name

name?: undefined | string;

The name of the Resource.

property requiredTags

requiredTags?: undefined | {[key: string]: any};

A mapping of tags which the resource has to have in order to be included in the result.

property resourceGroupName

resourceGroupName?: undefined | string;

The name of the Resource group where the Resources are located.

property type

type?: undefined | string;

The Resource Type of the Resources you want to list (e.g. Microsoft.Network/virtualNetworks). A full list of available Resource Types can be found here.

interface GetResourcesResult

interface GetResourcesResult

A collection of values returned by getResources.

property id

id: string;

id is the provider-assigned unique ID for this managed resource.

property name

name: string;

The name of this resource.

property requiredTags

requiredTags: {[key: string]: any};

property resourceGroupName

resourceGroupName: string;

property resources

resources: outputs.core.GetResourcesResource[];

One or more resource blocks as defined below.

property type

type: string;

The type of this resoource.

function getServiceClientCredentials

getServiceClientCredentials(): Promise<ServiceClientCredentials>

Obtain credentials to query Azure Management API. Depending on the environment configuration, this are either based on MSI, a service principal, or Azure CLI user credentials.

interface GetSubscriptionArgs

interface GetSubscriptionArgs

A collection of arguments for invoking getSubscription.

property subscriptionId

subscriptionId?: undefined | string;

Specifies the ID of the subscription. If this argument is omitted, the subscription ID of the current Azure Resource Manager provider is used.

interface GetSubscriptionResult

interface GetSubscriptionResult

A collection of values returned by getSubscription.

property displayName

displayName: string;

The subscription display name.

property id

id: string;

id is the provider-assigned unique ID for this managed resource.

property locationPlacementId

locationPlacementId: string;

The subscription location placement ID.

property quotaId

quotaId: string;

The subscription quota ID.

property spendingLimit

spendingLimit: string;

The subscription spending limit.

property state

state: string;

The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.

property subscriptionId

subscriptionId: string;

The subscription GUID.

property tenantId

tenantId: string;

The subscription tenant ID.

interface GetSubscriptionsArgs

interface GetSubscriptionsArgs

A collection of arguments for invoking getSubscriptions.

property displayNameContains

displayNameContains?: undefined | string;

A case-insensitive value which must be contained within the displayName field, used to filter the results

property displayNamePrefix

displayNamePrefix?: undefined | string;

A case-insensitive prefix which can be used to filter on the displayName field

interface GetSubscriptionsResult

interface GetSubscriptionsResult

A collection of values returned by getSubscriptions.

property displayNameContains

displayNameContains?: undefined | string;

property displayNamePrefix

displayNamePrefix?: undefined | string;

property id

id: string;

id is the provider-assigned unique ID for this managed resource.

property subscriptions

subscriptions: outputs.core.GetSubscriptionsSubscription[];

One or more subscription blocks as defined below.

interface GetUserAssignedIdentityArgs

interface GetUserAssignedIdentityArgs

A collection of arguments for invoking getUserAssignedIdentity.

property name

name: string;

The name of the User Assigned Identity.

property resourceGroupName

resourceGroupName: string;

The name of the Resource Group in which the User Assigned Identity exists.

interface GetUserAssignedIdentityResult

interface GetUserAssignedIdentityResult

A collection of values returned by getUserAssignedIdentity.

property clientId

clientId: string;

The Client ID of the User Assigned Identity.

property id

id: string;

id is the provider-assigned unique ID for this managed resource.

property location

location: string;

The Azure location where the User Assigned Identity exists.

property name

name: string;

property principalId

principalId: string;

The Service Principal ID of the User Assigned Identity.

property resourceGroupName

resourceGroupName: string;

property tags

tags: {[key: string]: string};

A mapping of tags assigned to the User Assigned Identity.

interface ResourceGroupArgs

interface ResourceGroupArgs

The set of arguments for constructing a ResourceGroup resource.

property location

location?: pulumi.Input<string>;

The location where the resource group should be created. For a list of all Azure locations, please consult this link or run az account list-locations --output table.

property name

name?: pulumi.Input<string>;

The name of the resource group. Must be unique on your Azure subscription.

property tags

tags?: pulumi.Input<{[key: string]: any}>;

A mapping of tags to assign to the resource.

interface ResourceGroupState

interface ResourceGroupState

Input properties used for looking up and filtering ResourceGroup resources.

property location

location?: pulumi.Input<string>;

The location where the resource group should be created. For a list of all Azure locations, please consult this link or run az account list-locations --output table.

property name

name?: pulumi.Input<string>;

The name of the resource group. Must be unique on your Azure subscription.

property tags

tags?: pulumi.Input<{[key: string]: any}>;

A mapping of tags to assign to the resource.

interface TemplateDeploymentArgs

interface TemplateDeploymentArgs

The set of arguments for constructing a TemplateDeployment resource.

property deploymentMode

deploymentMode: pulumi.Input<string>;

Specifies the mode that is used to deploy resources. This value could be either Incremental or Complete. Note that you will almost always want this to be set to Incremental otherwise the deployment will destroy all infrastructure not specified within the template, and this provider will not be aware of this.

property name

name?: pulumi.Input<string>;

Specifies the name of the template deployment. Changing this forces a new resource to be created.

property parameters

parameters?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;

Specifies the name and value pairs that define the deployment parameters for the template.

property parametersBody

parametersBody?: pulumi.Input<string>;

Specifies a valid Azure JSON parameters file that define the deployment parameters. It can contain KeyVault references

property resourceGroupName

resourceGroupName: pulumi.Input<string>;

The name of the resource group in which to create the template deployment.

property templateBody

templateBody?: pulumi.Input<string>;

Specifies the JSON definition for the template.

interface TemplateDeploymentState

interface TemplateDeploymentState

Input properties used for looking up and filtering TemplateDeployment resources.

property deploymentMode

deploymentMode?: pulumi.Input<string>;

Specifies the mode that is used to deploy resources. This value could be either Incremental or Complete. Note that you will almost always want this to be set to Incremental otherwise the deployment will destroy all infrastructure not specified within the template, and this provider will not be aware of this.

property name

name?: pulumi.Input<string>;

Specifies the name of the template deployment. Changing this forces a new resource to be created.

property outputs

outputs?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;

A map of supported scalar output types returned from the deployment (currently, Azure Template Deployment outputs of type String, Int and Bool are supported, and are converted to strings - others will be ignored) and can be accessed using .outputs["name"].

property parameters

parameters?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;

Specifies the name and value pairs that define the deployment parameters for the template.

property parametersBody

parametersBody?: pulumi.Input<string>;

Specifies a valid Azure JSON parameters file that define the deployment parameters. It can contain KeyVault references

property resourceGroupName

resourceGroupName?: pulumi.Input<string>;

The name of the resource group in which to create the template deployment.

property templateBody

templateBody?: pulumi.Input<string>;

Specifies the JSON definition for the template.