![](/img/trans.png)
[英]Query azure application gateway settings or whole ARM template from azure
[英]Simple ARM template not working in Azure Cli
我有一个简单的 ARM 部署脚本
az deployment group create \
--name <NAME> \
--resource-group <ResourceGroup> \
--template-file template.json \
--parameters @parameters.json
这有一个模板文件
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connections_ftp_name": {
"defaultValue": "ftp",
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('connections_ftp_name')]",
"location": "ukwest",
"kind": "V1",
"properties": {
"displayName": "[parameters('connections_ftp_name')]",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/SUBSCRIPTION/providers/Microsoft.Web/locations/ukwest/managedApis/', parameters('connections_ftp_name'))]"
}
}
}
]
}
和一个参数文件
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connections_ftp_name": {
"value": "my-name"
}
}
}
当我通过 Azure CLI 运行它时,我收到错误
az deployment group create \
> --name DeployMonitorFtp5 \
> --resource-group middleware.prod.rg \
> --template-file template.json \
> --parameters @parameters.json
←[K←[K←[91mDeployment failed. Correlation ID: 1f5b34ad-3105-4dfd-b4ca-d38a98fb800a. {
"error": {
"code": "ApiNotFound",
"message": "The API 'my-name' could not be found."
}
}←[0m
鉴于我想创建资源,这根本没有意义!
有人可以帮忙吗?
保罗
IT 与Az Cli
无关。 api
元素不应引用参数connections_ftp_name
。 它应该是:
"api": {
"id": "[concat('/subscriptions/SUBSCRIPTION/providers/Microsoft.Web/locations/ukwest/managedApis/ftp')]"
}
创建逻辑应用连接器时,还应指定连接器,这里是创建 ftp 连接器的完整示例:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"ftpConnectionAPIName": {
"type": "string",
"metadata": {
"description": "The name of the connection api to access the ftp."
}
},
"ftpServerAddress": {
"type": "string",
"metadata": {
"description": "The name of the ftp server address."
}
},
"ftpUsername": {
"type": "string",
"metadata": {
"description": "The name of the ftp user name."
}
},
"ftpPassword": {
"type": "securestring",
"metadata": {
"description": "The name of the ftp password."
}
}
},
"resources": [
{
"type": "Microsoft.Web/connections",
"name": "[parameters('ftpConnectionAPIName')]",
"apiVersion": "2016-06-01",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"displayName": "[parameters('ftpConnectionAPIName')]",
"parameterValues": {
"serverAddress": "[parameters('ftpServerAddress')]",
"userName": "[parameters('ftpUsername')]",
"password": "[parameters('ftpPassword')]"
},
"api": {
"id": "[concat('subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/ftp')]"
}
}
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.