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

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

azure.core.getSubscription

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

    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.then(current => current.displayName);
    
    import pulumi
    import pulumi_azure as azure
    
    current = azure.core.get_subscription()
    pulumi.export("currentSubscriptionDisplayName", current.display_name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := core.LookupSubscription(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("currentSubscriptionDisplayName", current.DisplayName)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var current = Azure.Core.GetSubscription.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["currentSubscriptionDisplayName"] = current.Apply(getSubscriptionResult => getSubscriptionResult.DisplayName),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.CoreFunctions;
    import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
    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 current = CoreFunctions.getSubscription();
    
            ctx.export("currentSubscriptionDisplayName", current.applyValue(getSubscriptionResult -> getSubscriptionResult.displayName()));
        }
    }
    
    variables:
      current:
        fn::invoke:
          Function: azure:core:getSubscription
          Arguments: {}
    outputs:
      currentSubscriptionDisplayName: ${current.displayName}
    

    Using getSubscription

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSubscription(args: GetSubscriptionArgs, opts?: InvokeOptions): Promise<GetSubscriptionResult>
    function getSubscriptionOutput(args: GetSubscriptionOutputArgs, opts?: InvokeOptions): Output<GetSubscriptionResult>
    def get_subscription(subscription_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetSubscriptionResult
    def get_subscription_output(subscription_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetSubscriptionResult]
    func LookupSubscription(ctx *Context, args *LookupSubscriptionArgs, opts ...InvokeOption) (*LookupSubscriptionResult, error)
    func LookupSubscriptionOutput(ctx *Context, args *LookupSubscriptionOutputArgs, opts ...InvokeOption) LookupSubscriptionResultOutput

    > Note: This function is named LookupSubscription in the Go SDK.

    public static class GetSubscription 
    {
        public static Task<GetSubscriptionResult> InvokeAsync(GetSubscriptionArgs args, InvokeOptions? opts = null)
        public static Output<GetSubscriptionResult> Invoke(GetSubscriptionInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSubscriptionResult> getSubscription(GetSubscriptionArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azure:core/getSubscription:getSubscription
      arguments:
        # arguments dictionary

    The following arguments are supported:

    SubscriptionId string
    Specifies the ID of the subscription. If this argument is omitted, the subscription ID of the current Azure Resource Manager provider is used.
    SubscriptionId string
    Specifies the ID of the subscription. If this argument is omitted, the subscription ID of the current Azure Resource Manager provider is used.
    subscriptionId String
    Specifies the ID of the subscription. If this argument is omitted, the subscription ID of the current Azure Resource Manager provider is used.
    subscriptionId string
    Specifies the ID of the subscription. If this argument is omitted, the subscription ID of the current Azure Resource Manager provider is used.
    subscription_id str
    Specifies the ID of the subscription. If this argument is omitted, the subscription ID of the current Azure Resource Manager provider is used.
    subscriptionId String
    Specifies the ID of the subscription. If this argument is omitted, the subscription ID of the current Azure Resource Manager provider is used.

    getSubscription Result

    The following output properties are available:

    DisplayName string
    The subscription display name.
    Id string
    The provider-assigned unique ID for this managed resource.
    LocationPlacementId string
    The subscription location placement ID.
    QuotaId string
    The subscription quota ID.
    SpendingLimit string
    The subscription spending limit.
    State string
    The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.
    SubscriptionId string
    The subscription GUID.
    Tags Dictionary<string, string>
    A mapping of tags assigned to the Subscription.
    TenantId string
    The subscription tenant ID.
    DisplayName string
    The subscription display name.
    Id string
    The provider-assigned unique ID for this managed resource.
    LocationPlacementId string
    The subscription location placement ID.
    QuotaId string
    The subscription quota ID.
    SpendingLimit string
    The subscription spending limit.
    State string
    The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.
    SubscriptionId string
    The subscription GUID.
    Tags map[string]string
    A mapping of tags assigned to the Subscription.
    TenantId string
    The subscription tenant ID.
    displayName String
    The subscription display name.
    id String
    The provider-assigned unique ID for this managed resource.
    locationPlacementId String
    The subscription location placement ID.
    quotaId String
    The subscription quota ID.
    spendingLimit String
    The subscription spending limit.
    state String
    The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.
    subscriptionId String
    The subscription GUID.
    tags Map<String,String>
    A mapping of tags assigned to the Subscription.
    tenantId String
    The subscription tenant ID.
    displayName string
    The subscription display name.
    id string
    The provider-assigned unique ID for this managed resource.
    locationPlacementId string
    The subscription location placement ID.
    quotaId string
    The subscription quota ID.
    spendingLimit string
    The subscription spending limit.
    state string
    The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.
    subscriptionId string
    The subscription GUID.
    tags {[key: string]: string}
    A mapping of tags assigned to the Subscription.
    tenantId string
    The subscription tenant ID.
    display_name str
    The subscription display name.
    id str
    The provider-assigned unique ID for this managed resource.
    location_placement_id str
    The subscription location placement ID.
    quota_id str
    The subscription quota ID.
    spending_limit str
    The subscription spending limit.
    state str
    The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.
    subscription_id str
    The subscription GUID.
    tags Mapping[str, str]
    A mapping of tags assigned to the Subscription.
    tenant_id str
    The subscription tenant ID.
    displayName String
    The subscription display name.
    id String
    The provider-assigned unique ID for this managed resource.
    locationPlacementId String
    The subscription location placement ID.
    quotaId String
    The subscription quota ID.
    spendingLimit String
    The subscription spending limit.
    state String
    The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted.
    subscriptionId String
    The subscription GUID.
    tags Map<String>
    A mapping of tags assigned to the Subscription.
    tenantId String
    The subscription tenant ID.

    Package Details

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

    We recommend using Azure Native.

    Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi