Skip to content

azurermNotificationHubAuthorizationRule

Manages an Authorization Rule associated with a Notification Hub within a Notification Hub Namespace.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "notificationhub-resources",
  }
);
const azurermNotificationHubNamespaceExample =
  new azurerm.notificationHubNamespace.NotificationHubNamespace(
    this,
    "example_1",
    {
      location: azurermResourceGroupExample.location,
      name: "myappnamespace",
      namespace_type: "NotificationHub",
      resource_group_name: azurermResourceGroupExample.name,
      sku_name: "Free",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermNotificationHubNamespaceExample.overrideLogicalId("example");
const azurermNotificationHubExample =
  new azurerm.notificationHub.NotificationHub(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: "mynotificationhub",
    namespace_name: azurermNotificationHubNamespaceExample.name,
    resource_group_name: azurermResourceGroupExample.name,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermNotificationHubExample.overrideLogicalId("example");
const azurermNotificationHubAuthorizationRuleExample =
  new azurerm.notificationHubAuthorizationRule.NotificationHubAuthorizationRule(
    this,
    "example_3",
    {
      listen: true,
      manage: true,
      name: "management-auth-rule",
      namespace_name: azurermNotificationHubNamespaceExample.name,
      notification_hub_name: azurermNotificationHubExample.name,
      resource_group_name: azurermResourceGroupExample.name,
      send: true,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermNotificationHubAuthorizationRuleExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name to use for this Authorization Rule. Changing this forces a new resource to be created.

  • notificationHubName - (Required) The name of the Notification Hub for which the Authorization Rule should be created. Changing this forces a new resource to be created.

  • namespaceName - (Required) The name of the Notification Hub Namespace in which the Notification Hub exists. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the Resource Group in which the Notification Hub Namespace exists. Changing this forces a new resource to be created.

  • manage - (Optional) Does this Authorization Rule have Manage access to the Notification Hub? Defaults to false.

-> NOTE: If manage is set to true then both send and listen must also be set to true.

  • send - (Optional) Does this Authorization Rule have Send access to the Notification Hub? Defaults to false.

  • listen - (Optional) Does this Authorization Rule have Listen access to the Notification Hub? Defaults to false.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Authorization Rule.

  • primaryAccessKey - The Primary Access Key associated with this Authorization Rule.

  • secondaryAccessKey - The Secondary Access Key associated with this Authorization Rule.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Notification Hub Authorization Rule.
  • update - (Defaults to 30 minutes) Used when updating the Notification Hub Authorization Rule.
  • read - (Defaults to 5 minutes) Used when retrieving the Notification Hub Authorization Rule.
  • delete - (Defaults to 30 minutes) Used when deleting the Notification Hub Authorization Rule.

Import

Notification Hub Authorization Rule can be imported using the resourceId, e.g.

terraform import azurerm_notification_hub_authorization_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.NotificationHubs/namespaces/namespace1/notificationHubs/hub1/authorizationRules/rule1