We recommend using Azure Native.
Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi
azure.apimanagement.getSubscription
Explore with Pulumi AI
Use this data source to access information about an existing API Management Subscription.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.apimanagement.getSubscription({
    apiManagementId: "example-apim",
    subscriptionId: "example-subscription-id",
});
export const id = example.then(example => example.subscriptionId);
import pulumi
import pulumi_azure as azure
example = azure.apimanagement.get_subscription(api_management_id="example-apim",
    subscription_id="example-subscription-id")
pulumi.export("id", example.subscription_id)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/apimanagement"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := apimanagement.LookupSubscription(ctx, &apimanagement.LookupSubscriptionArgs{
			ApiManagementId: "example-apim",
			SubscriptionId:  "example-subscription-id",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("id", example.SubscriptionId)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = Azure.ApiManagement.GetSubscription.Invoke(new()
    {
        ApiManagementId = "example-apim",
        SubscriptionId = "example-subscription-id",
    });
    return new Dictionary<string, object?>
    {
        ["id"] = example.Apply(getSubscriptionResult => getSubscriptionResult.SubscriptionId),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.apimanagement.ApimanagementFunctions;
import com.pulumi.azure.apimanagement.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 example = ApimanagementFunctions.getSubscription(GetSubscriptionArgs.builder()
            .apiManagementId("example-apim")
            .subscriptionId("example-subscription-id")
            .build());
        ctx.export("id", example.applyValue(getSubscriptionResult -> getSubscriptionResult.subscriptionId()));
    }
}
variables:
  example:
    fn::invoke:
      function: azure:apimanagement:getSubscription
      arguments:
        apiManagementId: example-apim
        subscriptionId: example-subscription-id
outputs:
  id: ${example.subscriptionId}
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(api_management_id: Optional[str] = None,
                     subscription_id: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetSubscriptionResult
def get_subscription_output(api_management_id: Optional[pulumi.Input[str]] = None,
                     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)
public static Output<GetSubscriptionResult> getSubscription(GetSubscriptionArgs args, InvokeOptions options)
fn::invoke:
  function: azure:apimanagement/getSubscription:getSubscription
  arguments:
    # arguments dictionaryThe following arguments are supported:
- ApiManagement stringId 
- The ID of the API Management Service in which this Subscription exists.
- SubscriptionId string
- The Identifier for the API Management Subscription.
- ApiManagement stringId 
- The ID of the API Management Service in which this Subscription exists.
- SubscriptionId string
- The Identifier for the API Management Subscription.
- apiManagement StringId 
- The ID of the API Management Service in which this Subscription exists.
- subscriptionId String
- The Identifier for the API Management Subscription.
- apiManagement stringId 
- The ID of the API Management Service in which this Subscription exists.
- subscriptionId string
- The Identifier for the API Management Subscription.
- api_management_ strid 
- The ID of the API Management Service in which this Subscription exists.
- subscription_id str
- The Identifier for the API Management Subscription.
- apiManagement StringId 
- The ID of the API Management Service in which this Subscription exists.
- subscriptionId String
- The Identifier for the API Management Subscription.
getSubscription Result
The following output properties are available:
- AllowTracing bool
- Indicates whether tracing is enabled.
- ApiId string
- The ID of the API assigned to this Subscription.
- ApiManagement stringId 
- DisplayName string
- The display name of this Subscription.
- Id string
- The provider-assigned unique ID for this managed resource.
- PrimaryKey string
- The primary key for this subscription.
- ProductId string
- The ID of the Product assigned to this Subscription.
- SecondaryKey string
- The secondary key for this subscription.
- State string
- The state of this Subscription.
- SubscriptionId string
- UserId string
- The ID of the User assigned to this Subscription.
- AllowTracing bool
- Indicates whether tracing is enabled.
- ApiId string
- The ID of the API assigned to this Subscription.
- ApiManagement stringId 
- DisplayName string
- The display name of this Subscription.
- Id string
- The provider-assigned unique ID for this managed resource.
- PrimaryKey string
- The primary key for this subscription.
- ProductId string
- The ID of the Product assigned to this Subscription.
- SecondaryKey string
- The secondary key for this subscription.
- State string
- The state of this Subscription.
- SubscriptionId string
- UserId string
- The ID of the User assigned to this Subscription.
- allowTracing Boolean
- Indicates whether tracing is enabled.
- apiId String
- The ID of the API assigned to this Subscription.
- apiManagement StringId 
- displayName String
- The display name of this Subscription.
- id String
- The provider-assigned unique ID for this managed resource.
- primaryKey String
- The primary key for this subscription.
- productId String
- The ID of the Product assigned to this Subscription.
- secondaryKey String
- The secondary key for this subscription.
- state String
- The state of this Subscription.
- subscriptionId String
- userId String
- The ID of the User assigned to this Subscription.
- allowTracing boolean
- Indicates whether tracing is enabled.
- apiId string
- The ID of the API assigned to this Subscription.
- apiManagement stringId 
- displayName string
- The display name of this Subscription.
- id string
- The provider-assigned unique ID for this managed resource.
- primaryKey string
- The primary key for this subscription.
- productId string
- The ID of the Product assigned to this Subscription.
- secondaryKey string
- The secondary key for this subscription.
- state string
- The state of this Subscription.
- subscriptionId string
- userId string
- The ID of the User assigned to this Subscription.
- allow_tracing bool
- Indicates whether tracing is enabled.
- api_id str
- The ID of the API assigned to this Subscription.
- api_management_ strid 
- display_name str
- The display name of this Subscription.
- id str
- The provider-assigned unique ID for this managed resource.
- primary_key str
- The primary key for this subscription.
- product_id str
- The ID of the Product assigned to this Subscription.
- secondary_key str
- The secondary key for this subscription.
- state str
- The state of this Subscription.
- subscription_id str
- user_id str
- The ID of the User assigned to this Subscription.
- allowTracing Boolean
- Indicates whether tracing is enabled.
- apiId String
- The ID of the API assigned to this Subscription.
- apiManagement StringId 
- displayName String
- The display name of this Subscription.
- id String
- The provider-assigned unique ID for this managed resource.
- primaryKey String
- The primary key for this subscription.
- productId String
- The ID of the Product assigned to this Subscription.
- secondaryKey String
- The secondary key for this subscription.
- state String
- The state of this Subscription.
- subscriptionId String
- userId String
- The ID of the User assigned to this Subscription.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.