gpt4 book ai didi

azure - 如何使用脚本对 Azure EventGrid API 连接进行身份验证?

转载 作者:行者123 更新时间:2023-12-02 08:02:40 25 4
gpt4 key购买 nike

我正在使用 ARM 模板创建 EventGrid API 连接。它已成功创建,但是,我仍然需要通过 Azure 门户手动对其进行身份验证。

这是我的 ARM 模板:

    "resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('azureEventGridConnectionAPIName')]",
"location": "[resourceGroup().location]",
"properties": {
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/', 'azureeventgrid')]"
},
"displayName": "[parameters('azureEventGridConnectionAPIName')]"
},
"dependsOn": []
}
]
  1. 模板中是否缺少负责立即验证连接的某些内容?

  2. 有没有办法使用 Azure PowerShell 等对连接进行身份验证,以便我可以自动化该过程?

最佳答案

Am i missing something in the template that is responsible for authenticating the Connection right away?

是的,我们可以在部署期间创建服务主体身份验证。以下是演示代码。

"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('azureEventGridConnectionAPIName')]",
"location": "[resourceGroup().location]",
"properties": {
"api": {
"id": "[concat('/subscriptions/subscriptionId', '/providers/Microsoft.Web/locations/', 'eastasia', '/managedApis/', 'azureeventgrid')]"

},
"parameterValues": {
"token:clientId": "[parameters('clientId')]",
"token:clientSecret": "[parameters('clientSecret')]",
"token:TenantId": "[parameters('TenantId')]",
"token:grantType": "[parameters('grantType')]"
},
"displayName": "[parameters('azureEventGridConnectionAPIName')]"

},
"dependsOn": []
}
]

Parameters.json

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"azureEventGridConnectionAPIName": {
"value": "azureEventGridConnectionAPIName"
},
"clientId": {
"value": "clientId"
},
"clientSecret": {
"value": "secret key"
},
"TenantId": {
"value": "tenant id"
},
"grantType": {
"value": "client_credentials"
}
}
}

关于azure - 如何使用脚本对 Azure EventGrid API 连接进行身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52445105/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com