1

我尝试使用 Azure Sphere 公共 API:设备组 -使用 Node.js删除。

但我收到错误消息:Error occurred while deleting deviceGroup --- for tenantId ---。(---:我的租户/设备组 ID)

但是“设备组 - 获取”方法效果很好。下面是部分测试代码。

  const config = {
    url: `https://prod.core.sphere.azure.net/v2/tenants/${tenantId}/devicegroups/${groupId}`,
    headers: {
      Authorization: `Bearer ${token}`
    },
    method: "DELETE"
  };

  try {
    const resp = await axios(config);
    console.log("resp:", resp);
  } catch (error) {
    console.error(error);
  }

在配置中,当我将方法更改为“GET”时,它可以工作。但是当使用“DELETE”方法时,出现了错误。

请检查这个。

4

1 回答 1

0

我注意到问题出在角色类型上。

要使用DELETEAzure Sphere Public API 的方法,似乎需要管理员角色

在我使用 Contributor 角色进行测试之前,出现了错误。

在此处输入图像描述

使用管理员角色,请求成功。

于 2021-02-22T06:04:26.647 回答