1. Packages
  2. Azure Classic
  3. API Docs
  4. core
  5. Subscription

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.core.Subscription

Explore with Pulumi AI

Example Usage

Creating A New Alias And Subscription For An Enrollment Account

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

const example = azure.billing.getEnrollmentAccountScope({
    billingAccountName: "1234567890",
    enrollmentAccountName: "0123456",
});
const exampleSubscription = new azure.core.Subscription("example", {
    subscriptionName: "My Example EA Subscription",
    billingScopeId: example.then(example => example.id),
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.billing.get_enrollment_account_scope(billing_account_name="1234567890",
    enrollment_account_name="0123456")
example_subscription = azure.core.Subscription("example",
    subscription_name="My Example EA Subscription",
    billing_scope_id=example.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/billing"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := billing.GetEnrollmentAccountScope(ctx, &billing.GetEnrollmentAccountScopeArgs{
			BillingAccountName:    "1234567890",
			EnrollmentAccountName: "0123456",
		}, nil)
		if err != nil {
			return err
		}
		_, err = core.NewSubscription(ctx, "example", &core.SubscriptionArgs{
			SubscriptionName: pulumi.String("My Example EA Subscription"),
			BillingScopeId:   pulumi.String(example.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Billing.GetEnrollmentAccountScope.Invoke(new()
    {
        BillingAccountName = "1234567890",
        EnrollmentAccountName = "0123456",
    });

    var exampleSubscription = new Azure.Core.Subscription("example", new()
    {
        SubscriptionName = "My Example EA Subscription",
        BillingScopeId = example.Apply(getEnrollmentAccountScopeResult => getEnrollmentAccountScopeResult.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.billing.BillingFunctions;
import com.pulumi.azure.billing.inputs.GetEnrollmentAccountScopeArgs;
import com.pulumi.azure.core.Subscription;
import com.pulumi.azure.core.SubscriptionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var example = BillingFunctions.getEnrollmentAccountScope(GetEnrollmentAccountScopeArgs.builder()
            .billingAccountName("1234567890")
            .enrollmentAccountName("0123456")
            .build());

        var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
            .subscriptionName("My Example EA Subscription")
            .billingScopeId(example.applyValue(getEnrollmentAccountScopeResult -> getEnrollmentAccountScopeResult.id()))
            .build());

    }
}
Copy
resources:
  exampleSubscription:
    type: azure:core:Subscription
    name: example
    properties:
      subscriptionName: My Example EA Subscription
      billingScopeId: ${example.id}
variables:
  example:
    fn::invoke:
      function: azure:billing:getEnrollmentAccountScope
      arguments:
        billingAccountName: '1234567890'
        enrollmentAccountName: '0123456'
Copy

Creating A New Alias And Subscription For A Microsoft Customer Account

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

const example = azure.billing.getMcaAccountScope({
    billingAccountName: "e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31",
    billingProfileName: "PE2Q-NOIT-BG7-TGB",
    invoiceSectionName: "MTT4-OBS7-PJA-TGB",
});
const exampleSubscription = new azure.core.Subscription("example", {
    subscriptionName: "My Example MCA Subscription",
    billingScopeId: example.then(example => example.id),
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.billing.get_mca_account_scope(billing_account_name="e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31",
    billing_profile_name="PE2Q-NOIT-BG7-TGB",
    invoice_section_name="MTT4-OBS7-PJA-TGB")
example_subscription = azure.core.Subscription("example",
    subscription_name="My Example MCA Subscription",
    billing_scope_id=example.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/billing"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := billing.GetMcaAccountScope(ctx, &billing.GetMcaAccountScopeArgs{
			BillingAccountName: "e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31",
			BillingProfileName: "PE2Q-NOIT-BG7-TGB",
			InvoiceSectionName: "MTT4-OBS7-PJA-TGB",
		}, nil)
		if err != nil {
			return err
		}
		_, err = core.NewSubscription(ctx, "example", &core.SubscriptionArgs{
			SubscriptionName: pulumi.String("My Example MCA Subscription"),
			BillingScopeId:   pulumi.String(example.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Billing.GetMcaAccountScope.Invoke(new()
    {
        BillingAccountName = "e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31",
        BillingProfileName = "PE2Q-NOIT-BG7-TGB",
        InvoiceSectionName = "MTT4-OBS7-PJA-TGB",
    });

    var exampleSubscription = new Azure.Core.Subscription("example", new()
    {
        SubscriptionName = "My Example MCA Subscription",
        BillingScopeId = example.Apply(getMcaAccountScopeResult => getMcaAccountScopeResult.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.billing.BillingFunctions;
import com.pulumi.azure.billing.inputs.GetMcaAccountScopeArgs;
import com.pulumi.azure.core.Subscription;
import com.pulumi.azure.core.SubscriptionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var example = BillingFunctions.getMcaAccountScope(GetMcaAccountScopeArgs.builder()
            .billingAccountName("e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31")
            .billingProfileName("PE2Q-NOIT-BG7-TGB")
            .invoiceSectionName("MTT4-OBS7-PJA-TGB")
            .build());

        var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
            .subscriptionName("My Example MCA Subscription")
            .billingScopeId(example.applyValue(getMcaAccountScopeResult -> getMcaAccountScopeResult.id()))
            .build());

    }
}
Copy
resources:
  exampleSubscription:
    type: azure:core:Subscription
    name: example
    properties:
      subscriptionName: My Example MCA Subscription
      billingScopeId: ${example.id}
variables:
  example:
    fn::invoke:
      function: azure:billing:getMcaAccountScope
      arguments:
        billingAccountName: e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31
        billingProfileName: PE2Q-NOIT-BG7-TGB
        invoiceSectionName: MTT4-OBS7-PJA-TGB
Copy

Creating A New Alias And Subscription For A Microsoft Partner Account

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

const example = azure.billing.getMpaAccountScope({
    billingAccountName: "e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31",
    customerName: "2281f543-7321-4cf9-1e23-edb4Oc31a31c",
});
const exampleSubscription = new azure.core.Subscription("example", {
    subscriptionName: "My Example MPA Subscription",
    billingScopeId: example.then(example => example.id),
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.billing.get_mpa_account_scope(billing_account_name="e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31",
    customer_name="2281f543-7321-4cf9-1e23-edb4Oc31a31c")
example_subscription = azure.core.Subscription("example",
    subscription_name="My Example MPA Subscription",
    billing_scope_id=example.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/billing"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := billing.GetMpaAccountScope(ctx, &billing.GetMpaAccountScopeArgs{
			BillingAccountName: "e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31",
			CustomerName:       "2281f543-7321-4cf9-1e23-edb4Oc31a31c",
		}, nil)
		if err != nil {
			return err
		}
		_, err = core.NewSubscription(ctx, "example", &core.SubscriptionArgs{
			SubscriptionName: pulumi.String("My Example MPA Subscription"),
			BillingScopeId:   pulumi.String(example.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Billing.GetMpaAccountScope.Invoke(new()
    {
        BillingAccountName = "e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31",
        CustomerName = "2281f543-7321-4cf9-1e23-edb4Oc31a31c",
    });

    var exampleSubscription = new Azure.Core.Subscription("example", new()
    {
        SubscriptionName = "My Example MPA Subscription",
        BillingScopeId = example.Apply(getMpaAccountScopeResult => getMpaAccountScopeResult.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.billing.BillingFunctions;
import com.pulumi.azure.billing.inputs.GetMpaAccountScopeArgs;
import com.pulumi.azure.core.Subscription;
import com.pulumi.azure.core.SubscriptionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var example = BillingFunctions.getMpaAccountScope(GetMpaAccountScopeArgs.builder()
            .billingAccountName("e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31")
            .customerName("2281f543-7321-4cf9-1e23-edb4Oc31a31c")
            .build());

        var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
            .subscriptionName("My Example MPA Subscription")
            .billingScopeId(example.applyValue(getMpaAccountScopeResult -> getMpaAccountScopeResult.id()))
            .build());

    }
}
Copy
resources:
  exampleSubscription:
    type: azure:core:Subscription
    name: example
    properties:
      subscriptionName: My Example MPA Subscription
      billingScopeId: ${example.id}
variables:
  example:
    fn::invoke:
      function: azure:billing:getMpaAccountScope
      arguments:
        billingAccountName: e879cf0f-2b4d-5431-109a-f72fc9868693:024cabf4-7321-4cf9-be59-df0c77ca51de_2019-05-31
        customerName: 2281f543-7321-4cf9-1e23-edb4Oc31a31c
Copy

Adding An Alias To An Existing Subscription

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

const example = new azure.core.Subscription("example", {
    alias: "examplesub",
    subscriptionName: "My Example Subscription",
    subscriptionId: "12345678-12234-5678-9012-123456789012",
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.Subscription("example",
    alias="examplesub",
    subscription_name="My Example Subscription",
    subscription_id="12345678-12234-5678-9012-123456789012")
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := core.NewSubscription(ctx, "example", &core.SubscriptionArgs{
			Alias:            pulumi.String("examplesub"),
			SubscriptionName: pulumi.String("My Example Subscription"),
			SubscriptionId:   pulumi.String("12345678-12234-5678-9012-123456789012"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.Subscription("example", new()
    {
        Alias = "examplesub",
        SubscriptionName = "My Example Subscription",
        SubscriptionId = "12345678-12234-5678-9012-123456789012",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.Subscription;
import com.pulumi.azure.core.SubscriptionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Subscription("example", SubscriptionArgs.builder()
            .alias("examplesub")
            .subscriptionName("My Example Subscription")
            .subscriptionId("12345678-12234-5678-9012-123456789012")
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:Subscription
    properties:
      alias: examplesub
      subscriptionName: My Example Subscription
      subscriptionId: 12345678-12234-5678-9012-123456789012
Copy

Create Subscription Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Subscription(name: string, args: SubscriptionArgs, opts?: CustomResourceOptions);
@overload
def Subscription(resource_name: str,
                 args: SubscriptionArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def Subscription(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 subscription_name: Optional[str] = None,
                 alias: Optional[str] = None,
                 billing_scope_id: Optional[str] = None,
                 subscription_id: Optional[str] = None,
                 tags: Optional[Mapping[str, str]] = None,
                 workload: Optional[str] = None)
func NewSubscription(ctx *Context, name string, args SubscriptionArgs, opts ...ResourceOption) (*Subscription, error)
public Subscription(string name, SubscriptionArgs args, CustomResourceOptions? opts = null)
public Subscription(String name, SubscriptionArgs args)
public Subscription(String name, SubscriptionArgs args, CustomResourceOptions options)
type: azure:core:Subscription
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SubscriptionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SubscriptionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SubscriptionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SubscriptionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SubscriptionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var azureSubscriptionResource = new Azure.Core.Subscription("azureSubscriptionResource", new()
{
    SubscriptionName = "string",
    Alias = "string",
    BillingScopeId = "string",
    SubscriptionId = "string",
    Tags = 
    {
        { "string", "string" },
    },
    Workload = "string",
});
Copy
example, err := core.NewSubscription(ctx, "azureSubscriptionResource", &core.SubscriptionArgs{
	SubscriptionName: pulumi.String("string"),
	Alias:            pulumi.String("string"),
	BillingScopeId:   pulumi.String("string"),
	SubscriptionId:   pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Workload: pulumi.String("string"),
})
Copy
var azureSubscriptionResource = new Subscription("azureSubscriptionResource", SubscriptionArgs.builder()
    .subscriptionName("string")
    .alias("string")
    .billingScopeId("string")
    .subscriptionId("string")
    .tags(Map.of("string", "string"))
    .workload("string")
    .build());
Copy
azure_subscription_resource = azure.core.Subscription("azureSubscriptionResource",
    subscription_name="string",
    alias="string",
    billing_scope_id="string",
    subscription_id="string",
    tags={
        "string": "string",
    },
    workload="string")
Copy
const azureSubscriptionResource = new azure.core.Subscription("azureSubscriptionResource", {
    subscriptionName: "string",
    alias: "string",
    billingScopeId: "string",
    subscriptionId: "string",
    tags: {
        string: "string",
    },
    workload: "string",
});
Copy
type: azure:core:Subscription
properties:
    alias: string
    billingScopeId: string
    subscriptionId: string
    subscriptionName: string
    tags:
        string: string
    workload: string
Copy

Subscription Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Subscription resource accepts the following input properties:

SubscriptionName This property is required. string
The Name of the Subscription. This is the Display Name in the portal.
Alias Changes to this property will trigger replacement. string
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
BillingScopeId string
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
SubscriptionId Changes to this property will trigger replacement. string

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

Tags Dictionary<string, string>
A mapping of tags to assign to the Subscription.
Workload Changes to this property will trigger replacement. string
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
SubscriptionName This property is required. string
The Name of the Subscription. This is the Display Name in the portal.
Alias Changes to this property will trigger replacement. string
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
BillingScopeId string
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
SubscriptionId Changes to this property will trigger replacement. string

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

Tags map[string]string
A mapping of tags to assign to the Subscription.
Workload Changes to this property will trigger replacement. string
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
subscriptionName This property is required. String
The Name of the Subscription. This is the Display Name in the portal.
alias Changes to this property will trigger replacement. String
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
billingScopeId String
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
subscriptionId Changes to this property will trigger replacement. String

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

tags Map<String,String>
A mapping of tags to assign to the Subscription.
workload Changes to this property will trigger replacement. String
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
subscriptionName This property is required. string
The Name of the Subscription. This is the Display Name in the portal.
alias Changes to this property will trigger replacement. string
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
billingScopeId string
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
subscriptionId Changes to this property will trigger replacement. string

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

tags {[key: string]: string}
A mapping of tags to assign to the Subscription.
workload Changes to this property will trigger replacement. string
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
subscription_name This property is required. str
The Name of the Subscription. This is the Display Name in the portal.
alias Changes to this property will trigger replacement. str
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
billing_scope_id str
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
subscription_id Changes to this property will trigger replacement. str

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

tags Mapping[str, str]
A mapping of tags to assign to the Subscription.
workload Changes to this property will trigger replacement. str
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
subscriptionName This property is required. String
The Name of the Subscription. This is the Display Name in the portal.
alias Changes to this property will trigger replacement. String
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
billingScopeId String
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
subscriptionId Changes to this property will trigger replacement. String

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

tags Map<String>
A mapping of tags to assign to the Subscription.
workload Changes to this property will trigger replacement. String
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the Subscription resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
TenantId string
The ID of the Tenant to which the subscription belongs.
Id string
The provider-assigned unique ID for this managed resource.
TenantId string
The ID of the Tenant to which the subscription belongs.
id String
The provider-assigned unique ID for this managed resource.
tenantId String
The ID of the Tenant to which the subscription belongs.
id string
The provider-assigned unique ID for this managed resource.
tenantId string
The ID of the Tenant to which the subscription belongs.
id str
The provider-assigned unique ID for this managed resource.
tenant_id str
The ID of the Tenant to which the subscription belongs.
id String
The provider-assigned unique ID for this managed resource.
tenantId String
The ID of the Tenant to which the subscription belongs.

Look up Existing Subscription Resource

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

public static get(name: string, id: Input<ID>, state?: SubscriptionState, opts?: CustomResourceOptions): Subscription
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        alias: Optional[str] = None,
        billing_scope_id: Optional[str] = None,
        subscription_id: Optional[str] = None,
        subscription_name: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tenant_id: Optional[str] = None,
        workload: Optional[str] = None) -> Subscription
func GetSubscription(ctx *Context, name string, id IDInput, state *SubscriptionState, opts ...ResourceOption) (*Subscription, error)
public static Subscription Get(string name, Input<string> id, SubscriptionState? state, CustomResourceOptions? opts = null)
public static Subscription get(String name, Output<String> id, SubscriptionState state, CustomResourceOptions options)
resources:  _:    type: azure:core:Subscription    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Alias Changes to this property will trigger replacement. string
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
BillingScopeId string
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
SubscriptionId Changes to this property will trigger replacement. string

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

SubscriptionName string
The Name of the Subscription. This is the Display Name in the portal.
Tags Dictionary<string, string>
A mapping of tags to assign to the Subscription.
TenantId string
The ID of the Tenant to which the subscription belongs.
Workload Changes to this property will trigger replacement. string
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
Alias Changes to this property will trigger replacement. string
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
BillingScopeId string
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
SubscriptionId Changes to this property will trigger replacement. string

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

SubscriptionName string
The Name of the Subscription. This is the Display Name in the portal.
Tags map[string]string
A mapping of tags to assign to the Subscription.
TenantId string
The ID of the Tenant to which the subscription belongs.
Workload Changes to this property will trigger replacement. string
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
alias Changes to this property will trigger replacement. String
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
billingScopeId String
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
subscriptionId Changes to this property will trigger replacement. String

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

subscriptionName String
The Name of the Subscription. This is the Display Name in the portal.
tags Map<String,String>
A mapping of tags to assign to the Subscription.
tenantId String
The ID of the Tenant to which the subscription belongs.
workload Changes to this property will trigger replacement. String
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
alias Changes to this property will trigger replacement. string
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
billingScopeId string
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
subscriptionId Changes to this property will trigger replacement. string

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

subscriptionName string
The Name of the Subscription. This is the Display Name in the portal.
tags {[key: string]: string}
A mapping of tags to assign to the Subscription.
tenantId string
The ID of the Tenant to which the subscription belongs.
workload Changes to this property will trigger replacement. string
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
alias Changes to this property will trigger replacement. str
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
billing_scope_id str
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
subscription_id Changes to this property will trigger replacement. str

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

subscription_name str
The Name of the Subscription. This is the Display Name in the portal.
tags Mapping[str, str]
A mapping of tags to assign to the Subscription.
tenant_id str
The ID of the Tenant to which the subscription belongs.
workload Changes to this property will trigger replacement. str
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.
alias Changes to this property will trigger replacement. String
The Alias name for the subscription. This provider will generate a new GUID if this is not supplied. Changing this forces a new Subscription to be created.
billingScopeId String
The Azure Billing Scope ID. Can be a Microsoft Customer Account Billing Scope ID, a Microsoft Partner Account Billing Scope ID or an Enrollment Billing Scope ID.
subscriptionId Changes to this property will trigger replacement. String

The ID of the Subscription. Changing this forces a new Subscription to be created.

NOTE: This value can be specified only for adopting control of an existing Subscription, it cannot be used to provide a custom Subscription ID.

NOTE: Either billing_scope_id or subscription_id has to be specified.

subscriptionName String
The Name of the Subscription. This is the Display Name in the portal.
tags Map<String>
A mapping of tags to assign to the Subscription.
tenantId String
The ID of the Tenant to which the subscription belongs.
workload Changes to this property will trigger replacement. String
The workload type of the Subscription. Possible values are Production (default) and DevTest. Changing this forces a new Subscription to be created.

Import

Subscriptions can be imported using the resource id, e.g.

$ pulumi import azure:core/subscription:Subscription example "/providers/Microsoft.Subscription/aliases/subscription1"
Copy

In this scenario, the subscription_id property can be completed and the provider will assume control of the existing subscription by creating an Alias. See the adding an Alias to an existing Subscription above. This provider requires an alias to correctly manage Subscription resources due to Azure Subscription API design.

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.