azure - 通过 POSTMAN 访问时无法获取事件中心描述
问题描述
我在 Azure 中创建了一个事件中心。
我正在尝试按照文档https://docs.microsoft.com/en-us/rest/api/eventhub/eventhubs/get获取指定事件中心的事件中心描述。
当我通过 POSTMAN 通过替换文档中指定的值来访问以下 URL 时:
https://management.azure.com/subscriptions/ {subscriptionId}/resourceGroup/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}?api-version=2017-04-01
但我收到以下错误:-
{
"error": {
"code": "AuthenticationFailed",
"message": "Authentication failed. The 'Authorization' header is missing."
}
}
知道如何获取有关事件中心的描述吗?
解决方案
因为您错过了请求中的令牌Bearer
,请尝试GET
使用.Bearer
Authorization
https://management.azure.com/subscriptions/<subscriptionId>/resourceGroups/<resourcegroup>/providers/Microsoft.EventHub/namespaces/<yourEventhubName>?api-version=2015-08-01
另外,我Bearer
是通过powershell和fiddler获取token的,大家可以参考一下步骤。
1.运行下面的powershell。
Get-AzureRmResource -ResourceGroupName <ResourceGroupName >-ResourceType Microsoft.EventHub/namespaces -ResourceName "<yourEventHubName>" -ApiVersion 2015-08-01
2.使用fiddler捕获请求,它会发送两个请求,选择任何一个,复制token即可。
在邮递员中,GET
使用Bearer
令牌发送,它在我这边工作正常。
推荐阅读
- druid - Druid:缓存查找失败,因为在摄取期间“找到 Null 或 Empty Dimension”
- c# - 如何在 Linq Select 语句中将函数作为表达式传递?
- mysql - 如何通过产品 ID 获取不同的状态计数
- c - 如何计算比赛?
- django - django 自定义保存方法以更改默认数据库
- angular - 路由器历史中的 Ionic 4/Angular 循环
- python - 如何在 gRPC 客户端-服务器框架上强制进行多处理以进行网络爬取?
- algorithm - DBSCAN/OPTICS 算法中是否包含半径 epsilon?
- ruby-on-rails-4 - Rails 服务器在 GCP VM 实例上运行,但无法在浏览器上访问 rails 应用程序
- python-3.x - Selenium-Webdriver 允许在一个窗口中打开多个选项卡,但在加载配置文件时不允许?