首页 > 解决方案 > 如何通过 Postman 获取我的架构(来自 Azure 架构注册表)?

问题描述

我正在尝试从 Azure 架构注册表获取架构。是否有可能通过 REST API 与 Schema Registry 进行通信?

标签: azureazure-eventhub

解决方案


如果您想从一个事件中心命名空间的架构组中获取架构,请参考以下步骤

  1. 创建服务主体并将 Azure RABC 角色分配给Schema Registry Readersp。更多详情请参考官方文档
az ad sp create-for-rbac -n "MyApp" --role "Schema Registry Reader"  --scope <the scope according to your need>
  1. 获取令牌
POST https://login.microsoftonline.com/<tennat id>/oauth2/v2.0/token

Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials
&client_id=
&client_secret=
&scope=https://eventhubs.azure.net/.default
  1. 调用接口

一种。列出架构组

https://<namespace name>.servicebus.windows.net/$schemagroups?api-version=2020-09-01-preview

Authorization: Bearer <token>

在此处输入图像描述

湾。列出一组中的模式

https://<namespace name>.servicebus.windows.net/$schemagroups/<group name>/schemas?api-version=2020-09-01-preview

Authorization: Bearer <token>

在此处输入图像描述

C。得到一个模式

https://<namespace name>.servicebus.windows.net/$schemagroups/<group name>/schemas/<>?api-version=2020-09-01-preview

Authorization: Bearer <token>

在此处输入图像描述

在此处输入图像描述


推荐阅读