Subscription
Manages a Subscription within a API Management Service.
Example Usage
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.GetServiceArgs;
import com.pulumi.azure.apimanagement.inputs.GetProductArgs;
import com.pulumi.azure.apimanagement.inputs.GetUserArgs;
import com.pulumi.azure.apimanagement.Subscription;
import com.pulumi.azure.apimanagement.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 exampleService = ApimanagementFunctions.getService(GetServiceArgs.builder()
.name("example-apim")
.resourceGroupName("example-resources")
.build());
final var exampleProduct = ApimanagementFunctions.getProduct(GetProductArgs.builder()
.productId("00000000-0000-0000-0000-000000000000")
.apiManagementName(exampleService.applyValue(getServiceResult -> getServiceResult.name()))
.resourceGroupName(exampleService.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
.build());
final var exampleUser = ApimanagementFunctions.getUser(GetUserArgs.builder()
.userId("11111111-1111-1111-1111-111111111111")
.apiManagementName(exampleService.applyValue(getServiceResult -> getServiceResult.name()))
.resourceGroupName(exampleService.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.apiManagementName(exampleService.applyValue(getServiceResult -> getServiceResult.name()))
.resourceGroupName(exampleService.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
.userId(exampleUser.applyValue(getUserResult -> getUserResult.id()))
.productId(exampleProduct.applyValue(getProductResult -> getProductResult.id()))
.displayName("Parser API")
.build());
}
}
Content copied to clipboard
Import
API Management Subscriptions can be imported using the resource id
, e.g.
$ pulumi import azure:apimanagement/subscription:Subscription example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.ApiManagement/service/example-apim/subscriptions/subscription-name
Content copied to clipboard