如何使用 Azure 资源管理器模板获取 Azure Maps 帐户的主键

How to get the Primary Key of Azure Maps Accounts with Azure Resource Manager Template

对于我的部署,我需要向我的前端提供 Azure Maps 帐户的主键。部署是使用 Azure 资源管理器模板完成的。

密钥应该写在ARM模板的输出中。

这可以通过以下代码实现:

"outputs": {
    "mapKey": {
        "type": "string",
        "value": "[listKeys(resourceId('Microsoft.Maps/accounts', variables('mapName')), providers('Microsoft.Maps', 'accounts').apiVersions[0]).primaryKey]",
        "metadata": {
            "description": "primary key for azure map"
        }
    }
}