【发布时间】: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]"
}
}
找到了类似的问题,但没有发现流分析:
- Azure ARM templates : DocumentDB primaryMasterKey as OUTPUT
- How to return Redis primaryKey via ARM template output?
- https://devkimchi.com/2018/01/05/list-of-access-keys-from-output-values-after-arm-template-deployment/
研究:
- https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-outputs?tabs=azure-powershell
- https://docs.microsoft.com/en-us/azure/stream-analytics/powerbi-output-managed-identity
- https://www.terraform.io/docs/providers/azurerm/r/template_deployment.html
非常感谢任何帮助,谢谢。
【问题讨论】:
-
请注意标签。 “arm”标签适用于 ARM 微控制器,而不适用于 Azure 资源管理器。
标签: azure azure-resource-manager arm-template azure-stream-analytics