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

We recommend using Azure Native.

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

azure.apimanagement.ProductGroup

Explore with Pulumi AI

Manages an API Management Product Assignment to a Group.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.apimanagement.getService({
    name: "example-api",
    resourceGroupName: "example-resources",
});
const exampleGetProduct = Promise.all([example, example]).then(([example, example1]) => azure.apimanagement.getProduct({
    productId: "my-product",
    apiManagementName: example.name,
    resourceGroupName: example1.resourceGroupName,
}));
const exampleGetGroup = Promise.all([example, example]).then(([example, example1]) => azure.apimanagement.getGroup({
    name: "my-group",
    apiManagementName: example.name,
    resourceGroupName: example1.resourceGroupName,
}));
const exampleProductGroup = new azure.apimanagement.ProductGroup("example", {
    productId: exampleGetProduct.then(exampleGetProduct => exampleGetProduct.productId),
    groupName: exampleGetGroup.then(exampleGetGroup => exampleGetGroup.name),
    apiManagementName: example.then(example => example.name),
    resourceGroupName: example.then(example => example.resourceGroupName),
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.apimanagement.get_service(name="example-api",
    resource_group_name="example-resources")
example_get_product = azure.apimanagement.get_product(product_id="my-product",
    api_management_name=example.name,
    resource_group_name=example.resource_group_name)
example_get_group = azure.apimanagement.get_group(name="my-group",
    api_management_name=example.name,
    resource_group_name=example.resource_group_name)
example_product_group = azure.apimanagement.ProductGroup("example",
    product_id=example_get_product.product_id,
    group_name=example_get_group.name,
    api_management_name=example.name,
    resource_group_name=example.resource_group_name)
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.LookupService(ctx, &apimanagement.LookupServiceArgs{
			Name:              "example-api",
			ResourceGroupName: "example-resources",
		}, nil)
		if err != nil {
			return err
		}
		exampleGetProduct, err := apimanagement.LookupProduct(ctx, &apimanagement.LookupProductArgs{
			ProductId:         "my-product",
			ApiManagementName: example.Name,
			ResourceGroupName: example.ResourceGroupName,
		}, nil)
		if err != nil {
			return err
		}
		exampleGetGroup, err := apimanagement.LookupGroup(ctx, &apimanagement.LookupGroupArgs{
			Name:              "my-group",
			ApiManagementName: example.Name,
			ResourceGroupName: example.ResourceGroupName,
		}, nil)
		if err != nil {
			return err
		}
		_, err = apimanagement.NewProductGroup(ctx, "example", &apimanagement.ProductGroupArgs{
			ProductId:         pulumi.String(exampleGetProduct.ProductId),
			GroupName:         pulumi.String(exampleGetGroup.Name),
			ApiManagementName: pulumi.String(example.Name),
			ResourceGroupName: pulumi.String(example.ResourceGroupName),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.ApiManagement.GetService.Invoke(new()
    {
        Name = "example-api",
        ResourceGroupName = "example-resources",
    });

    var exampleGetProduct = Azure.ApiManagement.GetProduct.Invoke(new()
    {
        ProductId = "my-product",
        ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
        ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
    });

    var exampleGetGroup = Azure.ApiManagement.GetGroup.Invoke(new()
    {
        Name = "my-group",
        ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
        ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
    });

    var exampleProductGroup = new Azure.ApiManagement.ProductGroup("example", new()
    {
        ProductId = exampleGetProduct.Apply(getProductResult => getProductResult.ProductId),
        GroupName = exampleGetGroup.Apply(getGroupResult => getGroupResult.Name),
        ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
        ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
    });

});
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.GetServiceArgs;
import com.pulumi.azure.apimanagement.inputs.GetProductArgs;
import com.pulumi.azure.apimanagement.inputs.GetGroupArgs;
import com.pulumi.azure.apimanagement.ProductGroup;
import com.pulumi.azure.apimanagement.ProductGroupArgs;
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.getService(GetServiceArgs.builder()
            .name("example-api")
            .resourceGroupName("example-resources")
            .build());

        final var exampleGetProduct = ApimanagementFunctions.getProduct(GetProductArgs.builder()
            .productId("my-product")
            .apiManagementName(example.applyValue(getServiceResult -> getServiceResult.name()))
            .resourceGroupName(example.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
            .build());

        final var exampleGetGroup = ApimanagementFunctions.getGroup(GetGroupArgs.builder()
            .name("my-group")
            .apiManagementName(example.applyValue(getServiceResult -> getServiceResult.name()))
            .resourceGroupName(example.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
            .build());

        var exampleProductGroup = new ProductGroup("exampleProductGroup", ProductGroupArgs.builder()
            .productId(exampleGetProduct.applyValue(getProductResult -> getProductResult.productId()))
            .groupName(exampleGetGroup.applyValue(getGroupResult -> getGroupResult.name()))
            .apiManagementName(example.applyValue(getServiceResult -> getServiceResult.name()))
            .resourceGroupName(example.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
            .build());

    }
}
Copy
resources:
  exampleProductGroup:
    type: azure:apimanagement:ProductGroup
    name: example
    properties:
      productId: ${exampleGetProduct.productId}
      groupName: ${exampleGetGroup.name}
      apiManagementName: ${example.name}
      resourceGroupName: ${example.resourceGroupName}
variables:
  example:
    fn::invoke:
      function: azure:apimanagement:getService
      arguments:
        name: example-api
        resourceGroupName: example-resources
  exampleGetProduct:
    fn::invoke:
      function: azure:apimanagement:getProduct
      arguments:
        productId: my-product
        apiManagementName: ${example.name}
        resourceGroupName: ${example.resourceGroupName}
  exampleGetGroup:
    fn::invoke:
      function: azure:apimanagement:getGroup
      arguments:
        name: my-group
        apiManagementName: ${example.name}
        resourceGroupName: ${example.resourceGroupName}
Copy

Create ProductGroup Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ProductGroup(name: string, args: ProductGroupArgs, opts?: CustomResourceOptions);
@overload
def ProductGroup(resource_name: str,
                 args: ProductGroupArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def ProductGroup(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 api_management_name: Optional[str] = None,
                 group_name: Optional[str] = None,
                 product_id: Optional[str] = None,
                 resource_group_name: Optional[str] = None)
func NewProductGroup(ctx *Context, name string, args ProductGroupArgs, opts ...ResourceOption) (*ProductGroup, error)
public ProductGroup(string name, ProductGroupArgs args, CustomResourceOptions? opts = null)
public ProductGroup(String name, ProductGroupArgs args)
public ProductGroup(String name, ProductGroupArgs args, CustomResourceOptions options)
type: azure:apimanagement:ProductGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ProductGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ProductGroupArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ProductGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ProductGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ProductGroupArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var productGroupResource = new Azure.ApiManagement.ProductGroup("productGroupResource", new()
{
    ApiManagementName = "string",
    GroupName = "string",
    ProductId = "string",
    ResourceGroupName = "string",
});
Copy
example, err := apimanagement.NewProductGroup(ctx, "productGroupResource", &apimanagement.ProductGroupArgs{
	ApiManagementName: pulumi.String("string"),
	GroupName:         pulumi.String("string"),
	ProductId:         pulumi.String("string"),
	ResourceGroupName: pulumi.String("string"),
})
Copy
var productGroupResource = new ProductGroup("productGroupResource", ProductGroupArgs.builder()
    .apiManagementName("string")
    .groupName("string")
    .productId("string")
    .resourceGroupName("string")
    .build());
Copy
product_group_resource = azure.apimanagement.ProductGroup("productGroupResource",
    api_management_name="string",
    group_name="string",
    product_id="string",
    resource_group_name="string")
Copy
const productGroupResource = new azure.apimanagement.ProductGroup("productGroupResource", {
    apiManagementName: "string",
    groupName: "string",
    productId: "string",
    resourceGroupName: "string",
});
Copy
type: azure:apimanagement:ProductGroup
properties:
    apiManagementName: string
    groupName: string
    productId: string
    resourceGroupName: string
Copy

ProductGroup Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ProductGroup resource accepts the following input properties:

ApiManagementName
This property is required.
Changes to this property will trigger replacement.
string
The name of the API Management Service. Changing this forces a new resource to be created.
GroupName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
ProductId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ApiManagementName
This property is required.
Changes to this property will trigger replacement.
string
The name of the API Management Service. Changing this forces a new resource to be created.
GroupName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
ProductId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
apiManagementName
This property is required.
Changes to this property will trigger replacement.
String
The name of the API Management Service. Changing this forces a new resource to be created.
groupName
This property is required.
Changes to this property will trigger replacement.
String
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
productId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
apiManagementName
This property is required.
Changes to this property will trigger replacement.
string
The name of the API Management Service. Changing this forces a new resource to be created.
groupName
This property is required.
Changes to this property will trigger replacement.
string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
productId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
api_management_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the API Management Service. Changing this forces a new resource to be created.
group_name
This property is required.
Changes to this property will trigger replacement.
str
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
product_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
apiManagementName
This property is required.
Changes to this property will trigger replacement.
String
The name of the API Management Service. Changing this forces a new resource to be created.
groupName
This property is required.
Changes to this property will trigger replacement.
String
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
productId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the ProductGroup resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ProductGroup Resource

Get an existing ProductGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ProductGroupState, opts?: CustomResourceOptions): ProductGroup
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_management_name: Optional[str] = None,
        group_name: Optional[str] = None,
        product_id: Optional[str] = None,
        resource_group_name: Optional[str] = None) -> ProductGroup
func GetProductGroup(ctx *Context, name string, id IDInput, state *ProductGroupState, opts ...ResourceOption) (*ProductGroup, error)
public static ProductGroup Get(string name, Input<string> id, ProductGroupState? state, CustomResourceOptions? opts = null)
public static ProductGroup get(String name, Output<String> id, ProductGroupState state, CustomResourceOptions options)
resources:  _:    type: azure:apimanagement:ProductGroup    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ApiManagementName Changes to this property will trigger replacement. string
The name of the API Management Service. Changing this forces a new resource to be created.
GroupName Changes to this property will trigger replacement. string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
ProductId Changes to this property will trigger replacement. string
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
ApiManagementName Changes to this property will trigger replacement. string
The name of the API Management Service. Changing this forces a new resource to be created.
GroupName Changes to this property will trigger replacement. string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
ProductId Changes to this property will trigger replacement. string
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
apiManagementName Changes to this property will trigger replacement. String
The name of the API Management Service. Changing this forces a new resource to be created.
groupName Changes to this property will trigger replacement. String
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
productId Changes to this property will trigger replacement. String
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
apiManagementName Changes to this property will trigger replacement. string
The name of the API Management Service. Changing this forces a new resource to be created.
groupName Changes to this property will trigger replacement. string
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
productId Changes to this property will trigger replacement. string
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
api_management_name Changes to this property will trigger replacement. str
The name of the API Management Service. Changing this forces a new resource to be created.
group_name Changes to this property will trigger replacement. str
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
product_id Changes to this property will trigger replacement. str
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
apiManagementName Changes to this property will trigger replacement. String
The name of the API Management Service. Changing this forces a new resource to be created.
groupName Changes to this property will trigger replacement. String
The Name of the API Management Group within the API Management Service. Changing this forces a new resource to be created.
productId Changes to this property will trigger replacement. String
The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

Import

API Management Product Groups can be imported using the resource id, e.g.

$ pulumi import azure:apimanagement/productGroup:ProductGroup example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/products/exampleId/groups/groupId
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

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