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

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

azure.core.getSubscriptions

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

    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.then(available => available.subscriptions);
    export const firstAvailableSubscriptionDisplayName = available.then(available => available.subscriptions?.[0]?.displayName);
    
    import pulumi
    import pulumi_azure as azure
    
    available = azure.core.get_subscriptions()
    pulumi.export("availableSubscriptions", available.subscriptions)
    pulumi.export("firstAvailableSubscriptionDisplayName", available.subscriptions[0].display_name)
    
    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 {
    		available, err := core.GetSubscriptions(ctx, &core.GetSubscriptionsArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("availableSubscriptions", available.Subscriptions)
    		ctx.Export("firstAvailableSubscriptionDisplayName", available.Subscriptions[0].DisplayName)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var available = Azure.Core.GetSubscriptions.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["availableSubscriptions"] = available.Apply(getSubscriptionsResult => getSubscriptionsResult.Subscriptions),
            ["firstAvailableSubscriptionDisplayName"] = available.Apply(getSubscriptionsResult => getSubscriptionsResult.Subscriptions[0]?.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.GetSubscriptionsArgs;
    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 available = CoreFunctions.getSubscriptions();
    
            ctx.export("availableSubscriptions", available.applyValue(getSubscriptionsResult -> getSubscriptionsResult.subscriptions()));
            ctx.export("firstAvailableSubscriptionDisplayName", available.applyValue(getSubscriptionsResult -> getSubscriptionsResult.subscriptions()[0].displayName()));
        }
    }
    
    variables:
      available:
        fn::invoke:
          Function: azure:core:getSubscriptions
          Arguments: {}
    outputs:
      availableSubscriptions: ${available.subscriptions}
      firstAvailableSubscriptionDisplayName: ${available.subscriptions[0].displayName}
    

    Using getSubscriptions

    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 getSubscriptions(args: GetSubscriptionsArgs, opts?: InvokeOptions): Promise<GetSubscriptionsResult>
    function getSubscriptionsOutput(args: GetSubscriptionsOutputArgs, opts?: InvokeOptions): Output<GetSubscriptionsResult>
    def get_subscriptions(display_name_contains: Optional[str] = None,
                          display_name_prefix: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetSubscriptionsResult
    def get_subscriptions_output(display_name_contains: Optional[pulumi.Input[str]] = None,
                          display_name_prefix: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetSubscriptionsResult]
    func GetSubscriptions(ctx *Context, args *GetSubscriptionsArgs, opts ...InvokeOption) (*GetSubscriptionsResult, error)
    func GetSubscriptionsOutput(ctx *Context, args *GetSubscriptionsOutputArgs, opts ...InvokeOption) GetSubscriptionsResultOutput

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

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

    The following arguments are supported:

    DisplayNameContains string
    A case-insensitive value which must be contained within the display_name field, used to filter the results
    DisplayNamePrefix string
    A case-insensitive prefix which can be used to filter on the display_name field
    DisplayNameContains string
    A case-insensitive value which must be contained within the display_name field, used to filter the results
    DisplayNamePrefix string
    A case-insensitive prefix which can be used to filter on the display_name field
    displayNameContains String
    A case-insensitive value which must be contained within the display_name field, used to filter the results
    displayNamePrefix String
    A case-insensitive prefix which can be used to filter on the display_name field
    displayNameContains string
    A case-insensitive value which must be contained within the display_name field, used to filter the results
    displayNamePrefix string
    A case-insensitive prefix which can be used to filter on the display_name field
    display_name_contains str
    A case-insensitive value which must be contained within the display_name field, used to filter the results
    display_name_prefix str
    A case-insensitive prefix which can be used to filter on the display_name field
    displayNameContains String
    A case-insensitive value which must be contained within the display_name field, used to filter the results
    displayNamePrefix String
    A case-insensitive prefix which can be used to filter on the display_name field

    getSubscriptions Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Subscriptions List<GetSubscriptionsSubscription>
    One or more subscription blocks as defined below.
    DisplayNameContains string
    DisplayNamePrefix string
    Id string
    The provider-assigned unique ID for this managed resource.
    Subscriptions []GetSubscriptionsSubscription
    One or more subscription blocks as defined below.
    DisplayNameContains string
    DisplayNamePrefix string
    id String
    The provider-assigned unique ID for this managed resource.
    subscriptions List<GetSubscriptionsSubscription>
    One or more subscription blocks as defined below.
    displayNameContains String
    displayNamePrefix String
    id string
    The provider-assigned unique ID for this managed resource.
    subscriptions GetSubscriptionsSubscription[]
    One or more subscription blocks as defined below.
    displayNameContains string
    displayNamePrefix string
    id str
    The provider-assigned unique ID for this managed resource.
    subscriptions Sequence[GetSubscriptionsSubscription]
    One or more subscription blocks as defined below.
    display_name_contains str
    display_name_prefix str
    id String
    The provider-assigned unique ID for this managed resource.
    subscriptions List<Property Map>
    One or more subscription blocks as defined below.
    displayNameContains String
    displayNamePrefix String

    Supporting Types

    GetSubscriptionsSubscription

    DisplayName string
    The subscription display name.
    Id string
    The ID of this subscription.
    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 resource.
    TenantId string
    The subscription tenant ID.
    DisplayName string
    The subscription display name.
    Id string
    The ID of this subscription.
    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 resource.
    TenantId string
    The subscription tenant ID.
    displayName String
    The subscription display name.
    id String
    The ID of this subscription.
    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 resource.
    tenantId String
    The subscription tenant ID.
    displayName string
    The subscription display name.
    id string
    The ID of this subscription.
    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 resource.
    tenantId string
    The subscription tenant ID.
    display_name str
    The subscription display name.
    id str
    The ID of this subscription.
    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 resource.
    tenant_id str
    The subscription tenant ID.
    displayName String
    The subscription display name.
    id String
    The ID of this subscription.
    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 resource.
    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 v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi