未提供有效的身份验证

时间:2020-10-05 23:32:02

标签: azure-log-analytics

我被困在此wiki的步骤2.4中

在上一步中,我得到了一个有效的令牌。

为什么我会收到“未提供有效身份验证”?

我添加了一个名为Authorization的标头-参见图片。

我想念什么?

enter image description here

1 个答案:

答案 0 :(得分:1)

当我们使用Azure Log Analytics REST API进行查询时,我们需要使用print (df) data Flag Set 0 0 True A 1 8 True A 2 30 True A 3 -1 False A 4 -14 False A 5 20 True B 6 5 False B 7 19 False B 8 7 False C 9 8 False c df1 = pd.crosstab(df['Set'], df['Flag']) d = df1[df1.ne(0).all(axis=1)].min(axis=1).to_dict() print (d) {'A': 2, 'B': 1} df1 = (df[df['Set'].isin(d.keys())] .groupby(['Set', 'Flag'], group_keys=False) .apply(lambda x: x.head(d[x.name[0]]))) print (df1) data Flag Set 3 -1 False A 4 -14 False A 0 0 True A 1 8 True A 6 5 False B 5 20 True B 作为请求标头。有关更多详细信息,请参阅here

例如

  1. 注册Azure AD应用程序

  2. 为AD应用程序配置API权限 enter image description here

  3. 将AAD应用程序访问权限授予我们的Log Analytics工作区。请为AD应用程序分配Authorization=Bearer eyJ....角色

  4. 获取访问令牌

Log Analytics Reader
  1. 调用api
POST /<your tenant id>/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

grant_type =client_credentials
&client_id=<>
&client_secret=<>
&resource=https://westus2.api.loganalytics.io

enter image description here

相关问题