【问题标题】:Azure ARM templates - Stream Analytics identity.principalId as outputAzure ARM 模板 - 流分析 identity.principalId 作为输出
【发布时间】:2020-09-30 21:37:53
【问题描述】:

我有一个用于流分析作业的有效 ARM 模板,它创建了自己的“托管身份”,可以使用 AZ CLI 进行查询,例如:

'az stream-analytics job show -g <resource_group> -n <stream_analytics_job_name> -o json --query 'identity.principalId'

(部署是通过 Terraform 'azurerm_template_deployment' 模块)。

添加了一个 ARM 模板输出以使用“listkeys”返回此密钥:

    "outputs": {
        "principalId": {
        "type": "string",
        "value": "[listkeys(resourceId('Microsoft.StreamAnalytics/streamingjobs', parameters('StreamAnalyticsJobName')), parameters('ASAApiVersion')).identity.principalId]"
        }
    }
}

现在 ARM 部署失败,如资源组部署列表中所示:

{
  "code": "DeploymentFailed",
  "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
  "details": [
    {
      "code": "NotFound",
      "message": "{\r\n  \"code\": \"NotFound\",\r\n  \"message\": \"The webpage cannot be found.\",\r\n  \"details\": {\r\n    \"code\": \"404\",\r\n    \"message\": \"The webpage cannot be found.\",\r\n    \"correlationId\": \"<redacted>\",\r\n    \"requestId\": \"<redacted>\"\r\n  }\r\n}"
    }
  ]
}

从资源组活动日志中,在“编写 Steam 分析作业”下,列表键的操作失败 - 没有一个提供任何进一步的线索。

通过https://resources.azure.com 找到此流分析作业的“identity.principalId”:

...etc...
  "identity": {
    "principalId": "<redacted>",
    "tenantId": "<redacted>",
    "type": "SystemAssigned"
  },

还尝试了以下 ARM 模板输出,结果相同:

    "outputs": {
        "principalId": {
        "type": "string",
        "value": "[listkeys(resourceId('Microsoft.StreamAnalytics/streamingjobs', parameters('StreamAnalyticsJobName')), parameters('ASAApiVersion')).principalId]"
        }
    }

找到了类似的问题,但没有发现流分析:

研究:

非常感谢任何帮助,谢谢。

【问题讨论】:

  • 请注意标签。 “arm”标签适用于 ARM 微控制器,而不适用于 Azure 资源管理器。

标签: azure azure-resource-manager arm-template azure-stream-analytics


【解决方案1】:

当我试图获取主体 ID 而不是密钥(我的错)时,在其他地方 (How to get Principal Id in app service using Arm template?) 发现了答案。

使用以下 ARM 模板输出有效:

    "outputs": {
        "principalId": {
        "type": "string",
        "value": "[reference(resourceId('Microsoft.StreamAnalytics/streamingjobs', parameters('StreamAnalyticsJobName')), parameters('ASAApiVersion'), 'Full').identity.principalId]"
        }
    }

【讨论】:

    猜你喜欢
    • 2020-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-16
    • 2020-09-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多