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

We recommend using Azure Native.

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

azure.apimanagement.getSubscription

Explore with Pulumi AI

We recommend using Azure Native.

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

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);
Copy
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)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:apimanagement:getSubscription
      arguments:
        apiManagementId: example-apim
        subscriptionId: example-subscription-id
outputs:
  id: ${example.subscriptionId}
Copy

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>
Copy
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]
Copy
func LookupSubscription(ctx *Context, args *LookupSubscriptionArgs, opts ...InvokeOption) (*LookupSubscriptionResult, error)
func LookupSubscriptionOutput(ctx *Context, args *LookupSubscriptionOutputArgs, opts ...InvokeOption) LookupSubscriptionResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetSubscriptionResult> getSubscription(GetSubscriptionArgs args, InvokeOptions options)
public static Output<GetSubscriptionResult> getSubscription(GetSubscriptionArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:apimanagement/getSubscription:getSubscription
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ApiManagementId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the API Management Service in which this Subscription exists.
SubscriptionId This property is required. string
The Identifier for the API Management Subscription.
ApiManagementId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the API Management Service in which this Subscription exists.
SubscriptionId This property is required. string
The Identifier for the API Management Subscription.
apiManagementId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the API Management Service in which this Subscription exists.
subscriptionId This property is required. String
The Identifier for the API Management Subscription.
apiManagementId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the API Management Service in which this Subscription exists.
subscriptionId This property is required. string
The Identifier for the API Management Subscription.
api_management_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the API Management Service in which this Subscription exists.
subscription_id This property is required. str
The Identifier for the API Management Subscription.
apiManagementId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the API Management Service in which this Subscription exists.
subscriptionId This property is required. 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.
ApiManagementId string
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.
ApiManagementId string
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.
apiManagementId String
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.
apiManagementId string
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_id str
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.
apiManagementId String
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 azurerm Terraform Provider.

We recommend using Azure Native.

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