Sunday, September 5, 2021

azure function with docker

 {

    "$schema""http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion""1.0.0.0",
    "parameters": {
        "subscriptionId": {
            "type""string"
        },
        "name": {
            "type""string"
        },
        "location": {
            "type""string"
        },
        "hostingPlanName": {
            "type""string"
        },
        "serverFarmResourceGroup": {
            "type""string"
        },
        "alwaysOn": {
            "type""bool"
        },
        "storageAccountName": {
            "type""string"
        },
        "use32BitWorkerProcess": {
            "type""bool"
        },
        "linuxFxVersion": {
            "type""string"
        },
        "dockerRegistryUrl": {
            "type""string"
        },
        "dockerRegistryUsername": {
            "type""string"
        },
        "dockerRegistryPassword": {
            "type""securestring"
        },
        "dockerRegistryStartupCommand": {
            "type""string"
        }
    },
    "variables": {},
    "resources": [
        {
            "apiVersion""2018-11-01",
            "name""[parameters('name')]",
            "type""Microsoft.Web/sites",
            "kind""functionapp,linux",
            "location""[parameters('location')]",
            "tags": {},
            "dependsOn": [],
            "properties": {
                "name""[parameters('name')]",
                "siteConfig": {
                    "appSettings": [
                        {
                            "name""FUNCTIONS_EXTENSION_VERSION",
                            "value""~3"
                        },
                        {
                            "name""DOCKER_REGISTRY_SERVER_URL",
                            "value""[parameters('dockerRegistryUrl')]"
                        },
                        {
                            "name""DOCKER_REGISTRY_SERVER_USERNAME",
                            "value""[parameters('dockerRegistryUsername')]"
                        },
                        {
                            "name""DOCKER_REGISTRY_SERVER_PASSWORD",
                            "value""[parameters('dockerRegistryPassword')]"
                        },
                        {
                            "name""WEBSITES_ENABLE_APP_SERVICE_STORAGE",
                            "value""false"
                        },
                        {
                            "name""APPINSIGHTS_INSTRUMENTATIONKEY",
                            "value""c5ac382d-ff86-40f6-bba3-5d808c42edb5"
                        },
                        {
                            "name""APPLICATIONINSIGHTS_CONNECTION_STRING",
                            "value""InstrumentationKey=xxxxxxxxxxxx;IngestionEndpoint=https://westus2-0.in.applicationinsights.azure.com/"
                        },
                        {
                            "name""AzureWebJobsStorage",
                            "value""[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',listKeys(resourceId('55954b78-5022-4a56-9fdc-54207b3a74ab','swamy-resource-grp','Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2019-06-01').keys[0].value,';EndpointSuffix=','core.windows.net')]"
                        }
                    ],
                    "use32BitWorkerProcess""[parameters('use32BitWorkerProcess')]",
                    "linuxFxVersion""[parameters('linuxFxVersion')]",
                    "appCommandLine""[parameters('dockerRegistryStartupCommand')]",
                    "alwaysOn""[parameters('alwaysOn')]"
                },
                "serverFarmId""[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
                "clientAffinityEnabled"false
            }
        }
    ]
}