azure template output publish profile content

早过忘川 提交于 2019-12-13 20:18:11

问题


I'm using an Azure Template to set up a web site. I would like it to output the contents of the publish profile so that I can automate the deploying. Is this possible?

My current template looks something like this:

{
    ...
    "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": "..."
                }
            }
        }
    }
}

I've tried experimenting with the listkeys function but as I understand it you need to give the id of the resource, i.e. publish profile, that you want to get and I'm not sure how to get that.


回答1:


you need to use reference and\or listkeys functions for that.

it would looks something like this:

"publishUrl": "[reference(variables('webapp').name)[%propertynamegoeshere%]]"

same goes for other things; but you need to use listkeys function to get keys for the webapp.



来源:https://stackoverflow.com/questions/45459094/azure-template-output-publish-profile-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!