微软图形API - 创建应用程序(测试版)

3
我们正在尝试创建“应用程序资源类型”,如此处所述:https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/beta/resources/application.md 请求内容:
POST https://graph.microsoft.com/beta/applications

{
  "displayName": "MyCoolApp",
  "passwordCredentials": [{
    "customKeyIdentifier":"ObJix/HDVU+3+hH5RmA+dw==",
    "endDateTime":"2018-10-19T17:59:59.6521653Z",
    "keyId":"ed087fba-0068-431f-98d7-e6b74dedd931",
    "startDateTime":"2016-10-19T17:59:59.6521653Z",
    "value":"somepass"
  }]
}

结果如下:
{
  "error": {
    "code": "Request_BadRequest",
    "message": "The property 'value' does not exist on type 'Microsoft.DirectoryServices.PasswordCredential'. Make sure to only use property names that are defined by the type.",
    "innerError": {
      "request-id": "038aa3bd-2b99-4329-a2ae-bc11d2f64609",
      "date": "2018-02-04T14:23:57"
    }
  }
}

为什么value不存在?这是passwordCredentials资源的JSON表示形式。
{
  "customKeyIdentifier": "binary",
  "endDate": "String (timestamp)",
  "keyId": "guid",
  "startDate": "String (timestamp)",
  "value": "string"
}

这里有个相关的链接:https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/beta/resources/passwordcredential.md。但是,我们可以创建一个没有指定密码凭据的应用程序- 是的,该应用程序已创建并显示在应用程序列表中(https://apps.dev.microsoft.com/#/appList),但是我们仍然需要知道它的凭据。是否有任何方法可以通过编程方式创建带有提供的凭据的应用程序?
1个回答

6

好的,大家好,我已经搞清楚了。文档显然已经过时了,所以目前passwordCredentials的正确模式是:

[{
  "customKeyIdentifier": "binary",
  "endDateTime": "String (timestamp)",
  "keyId": "guid",
  "startDateTime": "String (timestamp)",
  "secretText": "string"
}...]

secretText是您应用程序密码的新属性名称,请不要再使用"value"

最终我只使用了2个属性:

{
  "endDateTime": "2020-10-19T17:59:59.53Z",
  "secretText": "should be 16-64 characters long"
}

我现在打算提交一个拉取请求来更改他们的文档。
顺便说一下,这是一个完整的资源架构,帮助我找到了它:https://graph.microsoft.com/beta/$metadata#applications/$entity

谢谢!我已经寻找这个很久了。 - jsw
@bora89 - SecretText是您在Postman中以新注册(创建)的应用程序身份调用Azure AD以获取OAuth令牌时使用的ClientSecret吗?在这种情况下,ClientId是新创建应用程序的AppId。 - whiskytangofoxtrot

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接