1. Packages
  2. Packages
  3. Azure Classic
  4. API Docs
  5. eventgrid
  6. NamespaceTopic

We recommend using Azure Native.

Viewing docs for Azure v6.35.0
published on Tuesday, Apr 21, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v6.35.0
published on Tuesday, Apr 21, 2026 by Pulumi

    Manages an Event Grid Namespace Topic.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "West Europe",
    });
    const exampleNamespace = new azure.eventgrid.Namespace("example", {
        name: "my-eventgrid-namespace",
        location: example.location,
        resourceGroupName: example.name,
    });
    const exampleNamespaceTopic = new azure.eventgrid.NamespaceTopic("example", {
        name: "topic-namespace-example",
        eventgridNamespaceId: test.id,
        eventRetentionInDays: 1,
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example_namespace = azure.eventgrid.Namespace("example",
        name="my-eventgrid-namespace",
        location=example.location,
        resource_group_name=example.name)
    example_namespace_topic = azure.eventgrid.NamespaceTopic("example",
        name="topic-namespace-example",
        eventgrid_namespace_id=test["id"],
        event_retention_in_days=1)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/eventgrid"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = eventgrid.NewNamespace(ctx, "example", &eventgrid.NamespaceArgs{
    			Name:              pulumi.String("my-eventgrid-namespace"),
    			Location:          example.Location,
    			ResourceGroupName: example.Name,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = eventgrid.NewNamespaceTopic(ctx, "example", &eventgrid.NamespaceTopicArgs{
    			Name:                 pulumi.String("topic-namespace-example"),
    			EventgridNamespaceId: pulumi.Any(test.Id),
    			EventRetentionInDays: pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "West Europe",
        });
    
        var exampleNamespace = new Azure.EventGrid.Namespace("example", new()
        {
            Name = "my-eventgrid-namespace",
            Location = example.Location,
            ResourceGroupName = example.Name,
        });
    
        var exampleNamespaceTopic = new Azure.EventGrid.NamespaceTopic("example", new()
        {
            Name = "topic-namespace-example",
            EventgridNamespaceId = test.Id,
            EventRetentionInDays = 1,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.eventgrid.Namespace;
    import com.pulumi.azure.eventgrid.NamespaceArgs;
    import com.pulumi.azure.eventgrid.NamespaceTopic;
    import com.pulumi.azure.eventgrid.NamespaceTopicArgs;
    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) {
            var example = new ResourceGroup("example", ResourceGroupArgs.builder()
                .name("example-resources")
                .location("West Europe")
                .build());
    
            var exampleNamespace = new Namespace("exampleNamespace", NamespaceArgs.builder()
                .name("my-eventgrid-namespace")
                .location(example.location())
                .resourceGroupName(example.name())
                .build());
    
            var exampleNamespaceTopic = new NamespaceTopic("exampleNamespaceTopic", NamespaceTopicArgs.builder()
                .name("topic-namespace-example")
                .eventgridNamespaceId(test.id())
                .eventRetentionInDays(1)
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: West Europe
      exampleNamespace:
        type: azure:eventgrid:Namespace
        name: example
        properties:
          name: my-eventgrid-namespace
          location: ${example.location}
          resourceGroupName: ${example.name}
      exampleNamespaceTopic:
        type: azure:eventgrid:NamespaceTopic
        name: example
        properties:
          name: topic-namespace-example
          eventgridNamespaceId: ${test.id}
          eventRetentionInDays: 1
    

    API Providers

    This resource uses the following Azure API Providers:

    • Microsoft.EventGrid - 2025-02-15

    Create NamespaceTopic Resource

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

    Constructor syntax

    new NamespaceTopic(name: string, args: NamespaceTopicArgs, opts?: CustomResourceOptions);
    @overload
    def NamespaceTopic(resource_name: str,
                       args: NamespaceTopicArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def NamespaceTopic(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       eventgrid_namespace_id: Optional[str] = None,
                       event_retention_in_days: Optional[int] = None,
                       name: Optional[str] = None)
    func NewNamespaceTopic(ctx *Context, name string, args NamespaceTopicArgs, opts ...ResourceOption) (*NamespaceTopic, error)
    public NamespaceTopic(string name, NamespaceTopicArgs args, CustomResourceOptions? opts = null)
    public NamespaceTopic(String name, NamespaceTopicArgs args)
    public NamespaceTopic(String name, NamespaceTopicArgs args, CustomResourceOptions options)
    
    type: azure:eventgrid:NamespaceTopic
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args NamespaceTopicArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args NamespaceTopicArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args NamespaceTopicArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NamespaceTopicArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NamespaceTopicArgs
    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 namespaceTopicResource = new Azure.EventGrid.NamespaceTopic("namespaceTopicResource", new()
    {
        EventgridNamespaceId = "string",
        EventRetentionInDays = 0,
        Name = "string",
    });
    
    example, err := eventgrid.NewNamespaceTopic(ctx, "namespaceTopicResource", &eventgrid.NamespaceTopicArgs{
    	EventgridNamespaceId: pulumi.String("string"),
    	EventRetentionInDays: pulumi.Int(0),
    	Name:                 pulumi.String("string"),
    })
    
    var namespaceTopicResource = new NamespaceTopic("namespaceTopicResource", NamespaceTopicArgs.builder()
        .eventgridNamespaceId("string")
        .eventRetentionInDays(0)
        .name("string")
        .build());
    
    namespace_topic_resource = azure.eventgrid.NamespaceTopic("namespaceTopicResource",
        eventgrid_namespace_id="string",
        event_retention_in_days=0,
        name="string")
    
    const namespaceTopicResource = new azure.eventgrid.NamespaceTopic("namespaceTopicResource", {
        eventgridNamespaceId: "string",
        eventRetentionInDays: 0,
        name: "string",
    });
    
    type: azure:eventgrid:NamespaceTopic
    properties:
        eventRetentionInDays: 0
        eventgridNamespaceId: string
        name: string
    

    NamespaceTopic 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 NamespaceTopic resource accepts the following input properties:

    EventgridNamespaceId string
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    EventRetentionInDays int
    Event retention for the namespace topic expressed in days. Defaults to 7.
    Name string
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    EventgridNamespaceId string
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    EventRetentionInDays int
    Event retention for the namespace topic expressed in days. Defaults to 7.
    Name string
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    eventgridNamespaceId String
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    eventRetentionInDays Integer
    Event retention for the namespace topic expressed in days. Defaults to 7.
    name String
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    eventgridNamespaceId string
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    eventRetentionInDays number
    Event retention for the namespace topic expressed in days. Defaults to 7.
    name string
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    eventgrid_namespace_id str
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    event_retention_in_days int
    Event retention for the namespace topic expressed in days. Defaults to 7.
    name str
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    eventgridNamespaceId String
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    eventRetentionInDays Number
    Event retention for the namespace topic expressed in days. Defaults to 7.
    name String
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the NamespaceTopic 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 NamespaceTopic Resource

    Get an existing NamespaceTopic 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?: NamespaceTopicState, opts?: CustomResourceOptions): NamespaceTopic
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            event_retention_in_days: Optional[int] = None,
            eventgrid_namespace_id: Optional[str] = None,
            name: Optional[str] = None) -> NamespaceTopic
    func GetNamespaceTopic(ctx *Context, name string, id IDInput, state *NamespaceTopicState, opts ...ResourceOption) (*NamespaceTopic, error)
    public static NamespaceTopic Get(string name, Input<string> id, NamespaceTopicState? state, CustomResourceOptions? opts = null)
    public static NamespaceTopic get(String name, Output<String> id, NamespaceTopicState state, CustomResourceOptions options)
    resources:  _:    type: azure:eventgrid:NamespaceTopic    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    EventRetentionInDays int
    Event retention for the namespace topic expressed in days. Defaults to 7.
    EventgridNamespaceId string
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    Name string
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    EventRetentionInDays int
    Event retention for the namespace topic expressed in days. Defaults to 7.
    EventgridNamespaceId string
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    Name string
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    eventRetentionInDays Integer
    Event retention for the namespace topic expressed in days. Defaults to 7.
    eventgridNamespaceId String
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    eventRetentionInDays number
    Event retention for the namespace topic expressed in days. Defaults to 7.
    eventgridNamespaceId string
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    name string
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    event_retention_in_days int
    Event retention for the namespace topic expressed in days. Defaults to 7.
    eventgrid_namespace_id str
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    name str
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.
    eventRetentionInDays Number
    Event retention for the namespace topic expressed in days. Defaults to 7.
    eventgridNamespaceId String
    The ID of the Event Grid Namespace. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Event Grid Namespace Topic. Changing this forces a new resource to be created.

    Import

    Event Grid Namespace Topics can be imported using the resource id, e.g.

    $ pulumi import azure:eventgrid/namespaceTopic:NamespaceTopic example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.EventGrid/namespaces/eventgrid1/topics/topic1
    

    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.
    azure logo

    We recommend using Azure Native.

    Viewing docs for Azure v6.35.0
    published on Tuesday, Apr 21, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.