【问题标题】:Not able to access azure digital twin API without user interaction无法在没有用户交互的情况下访问 Azure 数字孪生 API
【发布时间】:2020-09-21 06:03:12
【问题描述】:

我参考了这些答案,但我无法在没有浏览器交互的情况下对 Azure 数字孪生进行身份验证。

  1. How to access azure digital twin API using Service Principal?

  2. Is it possible to configure Azure Digital Twins API access for a Daemon App?

【问题讨论】:

    标签: azure-digital-twins


    【解决方案1】:

    这两个问题都与 Azure 数字孪生预览版在刷新之前有关。无需浏览器身份验证即可访问 Azure 数字孪生。您将需要 Azure.Identity 包。我用的是1.2.2版

    var credential =
        new ClientSecretCredential("{AZURE_TENANT_ID}, "{AZURE_CLIENT_ID}", "{AZURE_CLIENT_SECRET}");
    var client = new DigitalTwinsClient(new Uri("{AZURE_DIGITAL_TWINS_URL}"), credential);
    

    您需要将值替换为

    1. 您的 Azure AD 租户 ID。
    2. 您在 Azure AD 中创建的应用注册的客户端应用程序 ID。
    3. 客户端密码,您需要在“证书和密码”边栏的应用注册中创建此密码。
    4. Azure 数字孪生实例的 URL。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-08
      • 2021-12-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多