Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
azure模板输出发布配置文件内容_Azure_Azure Template - Fatal编程技术网

azure模板输出发布配置文件内容

azure模板输出发布配置文件内容,azure,azure-template,Azure,Azure Template,我正在使用Azure模板设置网站。我希望它输出发布配置文件的内容,这样我就可以自动化部署。这可能吗 我当前的模板如下所示: { ... "resources": [ { "type": "Microsoft.Web/sites", "kind": "app", "name": "[variables('webapp').name]", "apiVersion": "[v

我正在使用Azure模板设置网站。我希望它输出发布配置文件的内容,这样我就可以自动化部署。这可能吗

我当前的模板如下所示:

{
    ...
    "resources": [
        {
            "type": "Microsoft.Web/sites",
            "kind": "app",
            "name": "[variables('webapp').name]",
            "apiVersion": "[variables('webapp').version]",
            "location": "[variables('location')]",
            "tags": {},
            "properties": {
                "serverFarmId": "[variables('webapp').serviceplan.name]",
                "name": "[variables('webapp').name]"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Web/serverfarms', variables('webapp').serviceplan.name)]"
            ]
        },
        {
            "type": "Microsoft.Web/serverfarms",
            "sku": {
                "name": "B1",
                "tier": "Basic",
                "size": "B1",
                "family": "B",
                "capacity": 1
            },
            "kind": "app",
            "name": "[variables('webapp').serviceplan.name]",
            "apiVersion": "[variables('webapp').serviceplan.version]",
            "location": "[variables('location')]",
            "properties": {
                "name": "[variables('webapp').serviceplan.name]",
                "numberOfWorkers": 1
            },
            "dependsOn": []
        }
    ],
    "outputs": {
        "manifest": {
            "type": "object",
            "value": {
                "Website": {
                    "publishUrl": "...",
                    "userPWD": "...",
                    "msdeploySite": "..."
                }
            }
        }
    }
}
"publishUrl": "[reference(variables('webapp').name)[%propertynamegoeshere%]]"
我尝试过使用该函数,但据我所知,您需要提供您想要获取的资源id,即发布配置文件,我不确定如何获取该id。

您需要使用and \ or函数

看起来是这样的:

{
    ...
    "resources": [
        {
            "type": "Microsoft.Web/sites",
            "kind": "app",
            "name": "[variables('webapp').name]",
            "apiVersion": "[variables('webapp').version]",
            "location": "[variables('location')]",
            "tags": {},
            "properties": {
                "serverFarmId": "[variables('webapp').serviceplan.name]",
                "name": "[variables('webapp').name]"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Web/serverfarms', variables('webapp').serviceplan.name)]"
            ]
        },
        {
            "type": "Microsoft.Web/serverfarms",
            "sku": {
                "name": "B1",
                "tier": "Basic",
                "size": "B1",
                "family": "B",
                "capacity": 1
            },
            "kind": "app",
            "name": "[variables('webapp').serviceplan.name]",
            "apiVersion": "[variables('webapp').serviceplan.version]",
            "location": "[variables('location')]",
            "properties": {
                "name": "[variables('webapp').serviceplan.name]",
                "numberOfWorkers": 1
            },
            "dependsOn": []
        }
    ],
    "outputs": {
        "manifest": {
            "type": "object",
            "value": {
                "Website": {
                    "publishUrl": "...",
                    "userPWD": "...",
                    "msdeploySite": "..."
                }
            }
        }
    }
}
"publishUrl": "[reference(variables('webapp').name)[%propertynamegoeshere%]]"

其他事情也是如此;但是,您需要使用listkeys函数来获取Web应用程序的密钥。

语法重复不正确,请检查文档,您可以只添加缺少的]而不是DownVoting。不仅如此,我担心,整个语法都是错误的,[]for properties不起作用,现在正在编辑。[]要访问属性,您可以使用变量\参数,与。。referencex.parametery不起作用,而referencex[parametery]起作用@pedrocosta还有一个技巧,不要将visual studio用于arm模板,这有点不值得。帮你解决问题的一堆想法@佩德罗科斯塔别忘了投票: