使用 Azure 门户创建服务总线命名空间。Create a Service Bus namespace using the Azure portal

命名空间是一个适用于所有消息传送组件的作用域容器。A namespace is a scoping container for all messaging components. 多个队列和主题可以位于一个命名空间中,命名空间通常用作应用程序容器。Multiple queues and topics can reside within a single namespace, and namespaces often serve as application containers. 本文提供有关在 Azure 门户中创建命名空间的说明。This article provides instructions for creating a namespace in the Azure portal.

若要开始在 Azure 中使用服务总线消息实体,必须先使用在 Azure 中唯一的名称创建一个命名空间。To begin using Service Bus messaging entities in Azure, you must first create a namespace with a name that is unique across Azure. 命名空间提供了用于对应用程序中的服务总线资源进行寻址的范围容器。A namespace provides a scoping container for addressing Service Bus resources within your application.

创建命名空间:To create a namespace:

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 在门户的左侧导航窗格中,依次单击“+ 创建资源”、“集成”和“服务总线”。In the left navigation pane of the portal, click + Create a resource, then click Integration, and then click Service Bus.

  3. 在“创建命名空间” 对话框中,输入命名空间名称。In the Create namespace dialog, enter a namespace name. 系统会立即检查该名称是否可用。The system immediately checks to see if the name is available.

  4. 在确保命名空间名称可用后,选择定价层(基本版或标准版)。After making sure the namespace name is available, choose the pricing tier (Basic or Standard). 如果要使用主题和订阅,请务必选择“标准”。If you want to use topics and subscriptions, make sure to choose Standard. 基本定价层中不支持主题/订阅。Topics/subscriptions are not supported in the Basic pricing tier.

  5. 在“订阅” 字段中,选择要创建命名空间的 Azure 订阅。In the Subscription field, choose an Azure subscription in which to create the namespace.

  6. 在“资源组” 字段中,选择用于放置该命名空间的现有资源组,或者创建一个新资源组。In the Resource group field, choose an existing resource group in which the namespace will live, or create a new one.

  7. 在“位置” 中,选择应在其中托管该命名空间的国家或地区。In Location, choose the country or region in which your namespace should be hosted.

    创建命名空间

  8. 单击“创建” 。Click Create. 系统现已创建命名空间并已将其启用。The system now creates your namespace and enables it. 可能需要等待几分钟,因为系统会为你的帐户配置资源。You might have to wait several minutes as the system provisions resources for your account.

获取管理凭据Obtain the management credentials

创建新的命名空间时,会自动生成一项初始的共享访问签名 (SAS) 规则,将一对主密钥和辅助密钥关联到一起,向每个密钥授予对命名空间的所有资产的完全控制权限。Creating a new namespace automatically generates an initial Shared Access Signature (SAS) rule with an associated pair of primary and secondary keys that each grant full control over all aspects of the namespace. 请参阅服务总线身份验证和授权,了解如何创建更多的规则,对常规的发送者和接收者的权限进行更多限制。See Service Bus authentication and authorization for information about how to create further rules with more constrained rights for regular senders and receivers. 若要复制初始规则,请执行以下步骤:To copy the initial rule, follow these steps:

  1. 单击“所有资源”,然后单击新创建的命名空间名称。Click All resources, then click the newly created namespace name.

  2. 在命名空间窗口中,单击“共享访问策略”。In the namespace window, click Shared access policies.

  3. 在“共享访问策略”屏幕中,单击“RootManageSharedAccessKey”。In the Shared access policies screen, click RootManageSharedAccessKey.

    connection-info

  4. 在“策略: RootManageSharedAccessKey”窗口中,单击“主连接字符串”旁边的“复制”按钮,将连接字符串复制到剪贴板供以后使用。In the Policy: RootManageSharedAccessKey window, click the copy button next to Primary Connection String, to copy the connection string to your clipboard for later use. 将此值粘贴到记事本或其他某个临时位置。Paste this value into Notepad or some other temporary location.

    connection-string

  5. 重复上述步骤,将主键的值复制和粘贴到临时位置,以供稍后使用。Repeat the previous step, copying and pasting the value of Primary key to a temporary location for later use.

祝贺!Congratulations! 现在已创建一个服务总线消息传送命名空间。You have now created a Service Bus Messaging namespace.

后续步骤Next steps

查看服务总线 GitHub 示例,了解服务总线消息传送中的某些更高级的功能。Check out the Service Bus GitHub samples, which show some of the more advanced features of Service Bus messaging.