แก้ไข

แชร์ผ่าน


Assign a managed identity to an Event Grid custom topic or domain

This article shows you how to use the Azure portal and CLI to assign a system-assigned or a user-assigned managed identity to an Event Grid custom topic or a domain.

Enable identity when creating a topic or domain

In the Azure portal, when creating a topic or a domain, you can assign either a system-assigned identity or two user-assigned identities, but not both types of identities. Once the topic or domain is created, you can assign both types of identities by following steps in the Enable identity for an existing topic or domain section.

Enable system-assigned identity

On the Security page of the topic or domain creation wizard, select Enable system assigned identity.

Screenshot showing the Enable system assigned identity option selected.

Enable user-assigned identity

  1. On the Security page of the topic or domain creation wizard, select Add user assigned identity.

  2. In the Select user assigned identity window, select the subscription that has the user-assigned identity, select the user-assigned identity, and then click Select.

    Screenshot showing the Enable user assigned identity option selected.

Enable identity for an existing custom topic or domain

In this section, you learn how to enable a system-assigned identity or a user-assigned identity for an existing custom topic or domain.

When you use Azure portal, you can assign one system assigned identity and up to two user assigned identities to an existing topic or a domain.

The following procedures show you how to enable an identity for a custom topic. The steps for enabling an identity for a domain are similar.

  1. Go to the Azure portal.
  2. Search for Event Grid topics in the search bar at the top.
  3. Select the custom topic for which you want to enable the managed identity.
  4. Select Identity on the left menu.

To assign a system-assigned identity to a topic

  1. In the System assigned tab, turn on the switch to enable the identity.

  2. Select Save on the toolbar to save the setting.

    Identity page for a custom topic

To assign a user-assigned identity to a topic

  1. Create a user-assigned identity by following instructions in the Manage user-assigned managed identities article.

  2. On the Identity page, switch to the User assigned tab in the right pane, and then select + Add on the toolbar.

    Screenshot showing the User Assigned Identity tab

  3. In the Add user managed identity window, follow these steps:

    1. Select the Azure subscription that has the user-assigned identity.
    2. Select the user-assigned identity.
    3. Select Add.
  4. Refresh the list in the User assigned tab to see the added user-assigned identity.

You can use similar steps to enable an identity for an Event Grid domain.

Next steps

Add the identity to an appropriate role (for example, Service Bus Data Sender) on the destination (for example, a Service Bus queue). For detailed steps, see Grant managed identity the access to Event Grid destination.