Managed application botService channel, CHANNEL_NOT_SUPPORTED error - azure

I'm working on managed application that should contain a bot for the teams application.
At the moment the bot resources look like this:
{
"type": "Microsoft.BotService/botServices",
"name": "[concat(parameters('webAppName'), '-bs')]",
"kind": "azurebot",
"apiVersion": "2022-06-15-preview",
"location": "global",
"sku": {
"name": "F0"
},
"dependsOn": [
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('userAssignedIdentityName'))]",
"[resourceId('Microsoft.Web/sites', variables('webAppName'))]"
],
"properties": {
"displayName": "[parameters('webAppName')]",
"msaAppType": "MultiTenant",
"msaAppId": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('userAssignedIdentityName')), '2018-11-30').clientId]",
"endpoint": "[concat('https://', parameters('webAppName'), '.azurewebsites.net', '/api/v1/messages')]"
}
},
{
"type": "Microsoft.BotService/botServices/channels",
"apiVersion": "2022-06-15-preview",
"name": "[concat(parameters('webAppName'), '-bs/', '-tc')]",
"location": "global",
"sku": {
"name": "F0"
},
"kind": "azurebot",
"properties": {
"channelName": "MsTeamsChannel",
"properties": {
"isEnabled": true
}
},
"dependsOn": [
"[resourceId('Microsoft.BotService/botServices', concat(parameters('webAppName'), '-bs'))]"
]
}
The Microsoft.BotService/botServices/channels part is causing the issue:
{
"status": "Failed",
"error": {
"code": "ApplianceDeploymentFailed",
"message": "The operation to create appliance failed. Please check operations of deployment 'olwa11119' under resource group '/subscriptions/19...truncated...14/resourceGroups/mrg-test_managed_medx_app-previ-20220924201448'. Error message: 'At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.'",
"details": [
{
"code": "BadRequest",
"message": "{\r\n \"error\": {\r\n \"code\": \"CHANNEL_NOT_SUPPORTED\",\r\n \"message\": \"Channel is not supported\"\r\n }\r\n}"
}
]
}
}
Any tips how can i fix this? Thanks in advance.

Eventually with the million tries and fails i have found out what's wrong with the template. To fix this you have to change the "name" of the "Microsoft.BotService/botServices/channels" to "MsTeamsChannel", same as "channelName" in "properties".
It's not documented anywhere, even more, documentation is extremely misleading:
string (required)
Character limit: 2-64
Valid characters:
Alphanumerics, underscores, periods, and hyphens.
Start with alphanumeric.
So my working template now looks like this:
{
"type": "Microsoft.BotService/botServices/channels",
"apiVersion": "2022-06-15-preview",
"name": "[concat(parameters('webAppName'), '-bs', '/', 'MsTeamsChannel')]",
"location": "global",
"sku": {
"name": "F0"
},
"kind": "azurebot",
"properties": {
"channelName": "MsTeamsChannel",
"properties": {
"isEnabled": true,
"acceptedTerms": true
}
},
"dependsOn": [
"[resourceId('Microsoft.BotService/botServices', concat(parameters('webAppName'), '-bs'))]"
]
}
Hope this is going to save lots of time to someone.

Related

Azure ARM Deployment Error Missing master

I am working on setting up 3 resource groups dev/uat/prod and was looking for a way to use ARM deployment to keep the environments the same. I export the ARM template and export and I get the following error as my first error.
'edapdserver/master/Default' failed with message '{
11:23:06 - "error": {
11:23:06 - "code": "ParentResourceNotFound",
11:23:06 - "message": "Can not perform requested operation on nested resource. Parent resource 'dserver/master' not
11:23:06 - found."
11:23:06 - }
11:23:06 - }'
Then when I look at the json it exports I can only see the database that I created there not master.
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2022-02-01-preview",
"name": "[concat(parameters('servers_edapdserver_name'), '/my-database')]",
"location": "eastus",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('servers_dserver_name'))]"
],
"sku": {
"name": "Basic",
"tier": "Basic",
"capacity": 5
},
"kind": "v12.0,user",
"properties": {
"collation": "SQL_Latin1_General_CP1_CI_AS",
"maxSizeBytes": 2147483648,
"catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
"zoneRedundant": false,
"readScale": "Disabled",
"requestedBackupStorageRedundancy": "Geo",
"maintenanceConfigurationId": "/subscriptions/??/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default",
"isLedgerOn": false
}
}
This is where the code fails
{
"type": "Microsoft.Sql/servers/databases/securityAlertPolicies",
"apiVersion": "2022-02-01-preview",
"name": "[concat(parameters('servers_edapdserver_name'), '/master/Default')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('servers_edapdserver_name'))]"
],
"properties": {
"state": "Disabled",
"disabledAlerts": [
""
],
"emailAddresses": [
""
],
"emailAccountAdmins": false,
"retentionDays": 0
}
},
edit this is the server part:
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2022-02-01-preview",
"name": "[parameters('servers_edapdserver_name')]",
"location": "eastus",
"kind": "v12.0",
"properties": {
"administratorLogin": "??",
"administratorLoginPassword": "??",
"version": "12.0",
"minimalTlsVersion": "1.2",
"publicNetworkAccess": "Enabled",
"restrictOutboundNetworkAccess": "Disabled"
}
},

ARM template error while deploying azure function app

2021-01-04T11:03:16.0647360Z ##[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
2021-01-04T11:03:16.0659882Z ##[error]Details:
2021-01-04T11:03:16.0662124Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0663958Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0665674Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0667350Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0669314Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0671142Z ##[error]Check out the troubleshooting guide to see if your issue is addressed: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
2021-01-04T11:03:16.0672521Z ##[error]Task failed while creating or updating the template deployment.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"current_environment": {
"type": "string"
},
"instanceNo": {
"type": "string"
},
"current_app_name": {
"type": "string"
},
"current_app_name_short": {
"type": "string",
"defaultValue":"66"
// "maxLength": 4
},
"functionName": {
"type": "array",
"defaultValue": [
"searchindex",
"delta",
"product",
"catalog",
"category"
]
},
"vnetName": {
"type": "string",
"defaultValue":"networking-001"
},
"existingVirtualNetworkResourceGroup": {
"type": "string",
"defaultValue": "rg-networking-001"
}
},
"functions": [],
"variables": {
"commonprefix": "[concat(parameters('current_app_name'),'-',parameters('current_environment'),'-',parameters('instanceNo'))]",
"commonprefix1":"[concat(parameters('current_app_name_short'),parameters('current_environment'),parameters('instanceNo'))]"
},
"resources": [
{
"apiVersion": "2018-02-01",
"name": "[concat('plan-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
"type": "Microsoft.Web/serverfarms",
"location": "[resourceGroup().location]",
"kind": "linux",
"dependsOn": [],
"properties": {
"name": "[concat('plan-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
"workerSize": "3",
"workerSizeId": "3",
"numberOfWorkers": "1",
"reserved": true
},
"sku": {
"Tier": "PremiumV2",
"Name": "P1v2"
},
"copy": {
"name": "appplancopy",
"count": "[length(parameters('functionName'))]"
}
},
{
"type": "microsoft.insights/components",
"apiVersion": "2018-05-01-preview",
"name": "[concat('appi-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
"kind": "web",
"location": "[resourceGroup().location]",
"dependsOn": [],
"properties": {
"Application_Type": "web",
"RetentionInDays": 90,
"publicNetworkAccessForIngestion": "enabled",
"publicNetworkAccessForQuery": "enabled"
},
"copy": {
"name": "componentcopy",
"count": "[length(parameters('functionName'))]"
}
},
{
"apiVersion": "2019-06-01",
"type": "Microsoft.Storage/storageAccounts",
"name": "[concat('st',parameters('functionName')[copyIndex('')],variables('commonprefix1'))]",
"location": "[resourceGroup().location]",
"kind": "Storage",
"sku": {
"name": "Standard_LRS"
},
"properties": {
"supportsHttpsTrafficOnly": true
},
"copy": {
"name": "storagecopy",
"count": "[length(parameters('functionName'))]"
}
},
{
"apiVersion": "2018-11-01",
"name": "[concat('func-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
"type": "Microsoft.Web/sites",
"kind": "functionapp,linux",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('microsoft.insights/components', concat('appi-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]",
"[resourceId('Microsoft.Web/serverfarms', concat('plan-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]",
"[resourceId('Microsoft.Storage/storageAccounts', concat('st',parameters('functionName')[copyIndex('')],variables('commonprefix1')))]"
],
"properties": {
"name": "[concat('func-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
"clientAffinityEnabled": false,
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', concat('plan-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
},
"resources": [
{
"type": "networkConfig",
"apiVersion": "2019-08-01",
"name": "virtualNetwork",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', concat('func-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
],
"properties": {
"subnetResourceId": "[resourceId(parameters('existingVirtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'),concat('subnet-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
}
}
],
"copy": {
"name": "apppservicecopy",
"count": "[length(parameters('functionName'))]"
}
}
],
"outputs": {}}
According to the doc, we could see multiple reasons for this type of error:
The resource type you're trying to deploy isn't yet available in that region.
Downtime of either the service you're deploying to in the region you're deploying to.
Downtime of Azure DevOps itself.
You could switch the region and then try it again.
In addition, We could create ARM templates by using the Azure portal and then deploy azure function app via the template.
I can reproduce the same issue with your template. Please note that there is no networkConfig type and subnetResourceId properties in the template-Microsoft.Web sites/virtualNetworkConnections 2019-08-01, you could change the type to virtualNetworkConnections and properties to vnetResourceId like this:
{
"type": "virtualNetworkConnections",
"apiVersion": "2019-08-01",
"name": "virtualNetwork",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', concat('func-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
],
"properties": {
"vnetResourceId": "[resourceId(parameters('existingVirtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'),concat('subnet-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
}
}

Azure resource group move does not complete. Can not take any action on either resource group

I tried to move all the resources in a resources group to another and now both resource groups are pretty much inoperable. `
"value": [
{
"id": "/subscriptions/b14e1f80-b3a3-49aa-9f13-7a8d51cbbac3/resourceGroups/cloud-shell-storage-eastus",
"name": "cloud-shell-storage-eastus",
"location": "eastus",
"properties": {
"provisioningState": "Succeeded"
}
},
{
"id": "/subscriptions/b14e1f80-b3a3-49aa-9f13-7a8d51cbbac3/resourceGroups/NetworkWatcherRG",
"name": "NetworkWatcherRG",
"location": "eastus",
"properties": {
"provisioningState": "Succeeded"
}
},
{
"id": "/subscriptions/b14e1f80-b3a3-49aa-9f13-7a8d51cbbac3/resourceGroups/azuremolchapter19",
"name": "azuremolchapter19",
"location": "eastus",
"properties": {
"provisioningState": "MovingResources"
}
},
{
"id": "/subscriptions/b14e1f80-b3a3-49aa-9f13-7a8d51cbbac3/resourceGroups/MC_azuremolchapter19_azuremol_eastus",
"name": "MC_azuremolchapter19_azuremol_eastus",
"location": "eastus",
"tags": {},
"properties": {
"provisioningState": "MovingResources"
}
}
]
}
Cannot delete or any other operation.
"error": {
"code": "ResourcesBeingMoved",
"message": "The resource group 'MC_azuremolchapter19_azuremol_eastus' is being updated and cannot perform this operation."
Cannot find a solution. Can someone help?
}
I logged in a this morning and was able to delete the resource groups. Don't know where to find any logs outside of the subscription activity log where I could find any information as to what happened.

ARM get EventHub Namespace shareAcessPolicyKey

My goal is to deploy a streaming analytics who contain an eventhub as input. To do this, I need to get the shareAcessPolicyKey. After some search, I found the ListKeys function but still not working for my case.
{
"error": {
"code": "ResourceNotFound",
"message": "The Resource 'Microsoft.ServiceBus/namespaces/tbiNamespace' under resource group 'devOps' was not found."
}
.
EDIT - Solution
"sharedAccessPolicyKey": "[listKeys(resourceId('Microsoft.Eventhub/namespaces/authorizationRules',parameters('namespaces'), parameters('AuthorizationRules_name')),'2017-04-01').primaryKey]"
Create the namespaces rules
{
"type": "Microsoft.EventHub/namespaces/AuthorizationRules",
"name": "[concat(parameters('namespaces_tornosbi_name'), '/', parameters('AuthorizationRules_RootManageSharedAccessKey_name'))]",
"apiVersion": "2017-04-01",
"location": "North Europe",
"scale": null,
"properties": {
"rights": [
"Listen",
"Manage",
"Send"
]
},
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', parameters('namespaces_tornosbi_name'))]"
]
},
create the resource streaming jobs input
"resources": [{
"type": "Microsoft.StreamAnalytics/streamingjobs/inputs",
"name": "[concat(parameters('streamingjobs_tornosbi_name'), '/', parameters('inputs_eh_input_name'))]",
"apiVersion": "2016-03-01",
"scale": null,
"properties": {
"type": "Stream",
"datasource": {
"type": "Microsoft.ServiceBus/EventHub",
"properties": {
"eventHubName": "[parameters('eventhubs_tornosbi_hub_name')]",
"serviceBusNamespace": "[parameters('namespaces_tornosbi_name')]",
"sharedAccessPolicyName": "[parameters('AuthorizationRules_RootManageSharedAccessKey_name')]",
"sharedAccessPolicyKey": "[listKeys(resourceId(concat('Microsoft.ServiceBus/namespaces/','eventhub','/authorizationRules'),parameters('namespaces_tornosbi_name'),parameters('eventhubs_tornosbi_hub_name'),parameters('AuthorizationRules_RootManageSharedAccessKey_name')),'2016-03-01').primaryKey]"
}
},
"compression": {
"type": "None"
},
"serialization": {
"type": "Json",
"properties": {
"encoding": "UTF8"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.StreamAnalytics/streamingjobs', parameters('streamingjobs_tornosbi_name'))]",
"[resourceId('Microsoft.EventHub/namespaces', parameters('namespaces_tornosbi_name'))]",
"[resourceId('Microsoft.EventHub/namespaces/eventhubs', parameters('namespaces_tornosbi_name'), parameters('eventhubs_tornosbi_hub_name'))]"
]
},
the error clearly states there is no such resource in the resource group. Impossible to help you without knowing where the resource is, but resourceId() function accepts resource group and subscription as arguments:
resourceId(subscription, resourcegroup, 'Microsoft.ServiceBus/namespaces/eventhub/authorizationRules',
namespace, eventhub, rule)
ps. you dont need to do concat('Microsoft.ServiceBus/namespaces/','eventhub','/authorizationRules'), just use a string

(400) Bad Request when deploying a Function App via ARM

Hopefully, someone can tell me what I'm doing wrong with this ARM template deployment.
Using the template at the bottom of the question, I can deploy a Function App - with app service plan and storage account - but I get the following error.
STATUS BadRequest
PROVISIONING STATE Failed
TIMESTAMP 4/19/2017, 1:33:00 PM
DURATION 1 second
TYPE Microsoft.Web/sites/config
RESOURCE ID /subscriptions/blah-blah-blah/resourceGroups/blah/providers/Microsoft.Web/sites/functionname/config/appsettings
STATUSMESSAGE {
"Code": "BadRequest",
"Message": "There was a conflict. The remote server returned an error: (400) Bad Request.",
"Target": null,
"Details": [
{
"Message": "There was a conflict. The remote server returned an error: (400) Bad Request."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"ExtendedCode": "01020",
"MessageTemplate": "There was a conflict. {0}",
"Parameters": [
"The remote server returned an error: (400) Bad Request."
],
"Code": "BadRequest",
"Message": "There was a conflict. The remote server returned an error: (400) Bad Request."
}
}],
"Innererror": null
}
RESOURCE functionname/appsettings
If I remove this AppSetting property from the function app part of the template then the deployment works fine.
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('Storage_Account_Name'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('Storage_Account_Name')),'2015-05-01-preview').key1)]",
But then when I go to the deployed function app I get this error popup.
Error:
'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING' application setting is missing from your app. This setting contains a connection string for an Azure Storage account that is used to host your functions content. Your app will be completely broken without this setting. You may need to delete and recreate this function app if you no longer have access to the value of that application setting.
I also note that if I try and add that appsetting in the portal manually after this successful deployment, I get the same error as the initial deployment.
So, I don't know if I'm putting it in the template incorrectly, or if something in the Azure Deployment for functions apps is broken.
Where am I going wrong?
Template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"App_Service_Plan_Name": {
"defaultValue": "aspname",
"type": "String"
},
"Functions_App_Name": {
"defaultValue": "funcname",
"type": "String"
},
"Storage_Account_Name": {
"defaultValue": "storagename",
"type": "String"
}
},
"variables": {},
"resources": [
{
"comments": "Deployed from template",
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('Storage_Account_Name')]",
"apiVersion": "2016-01-01",
"sku": {
"name": "Standard_LRS"
},
"location": "[resourceGroup().location]",
"kind": "Storage"
},
{
"comments": "Deployed from template",
"type": "Microsoft.Web/serverfarms",
"sku": {
"name": "Y1",
"tier": "Dynamic",
"size": "Y1",
"family": "Y",
"capacity": 0
},
"kind": "functionapp",
"name": "[parameters('App_Service_Plan_Name')]",
"apiVersion": "2015-08-01",
"location": "[resourceGroup().location]",
"properties": {
"name": "[parameters('App_Service_Plan_Name')]",
"numberOfWorkers": 0
},
"dependsOn": []
},
{
"comments": "Deployed from template",
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"name": "[parameters('Functions_App_Name')]",
"apiVersion": "2015-08-01",
"location": "[resourceGroup().location]",
"properties": {
"name": "[parameters('Functions_App_Name')]",
"hostNames": [
"[concat(parameters('Functions_App_Name'),'.azurewebsites.net')]"
],
"enabledHostNames": [
"[concat(parameters('Functions_App_Name'),'.azurewebsites.net')]",
"[concat(parameters('Functions_App_Name'),'.scm.azurewebsites.net')]"
],
"hostNameSslStates": [
{
"name": "[concat(parameters('Functions_App_Name'),'.azurewebsites.net')]",
"sslState": 0,
"thumbprint": null,
"ipBasedSslState": 0
},
{
"name": "[concat(parameters('Functions_App_Name'),'.scm.azurewebsites.net')]",
"sslState": 0,
"thumbprint": null,
"ipBasedSslState": 0
}
],
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('App_Service_Plan_Name'))]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('App_Service_Plan_Name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('Storage_Account_Name'))]"
],
"resources": [
{
"apiVersion": "2015-08-01",
"name": "appsettings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('Functions_App_Name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('Storage_Account_Name'))]"
],
"properties": {
"FUNCTIONS_EXTENSION_VERSION": "~1",
"AzureWebJobsDashboard": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('Storage_Account_Name'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('Storage_Account_Name')),'2015-05-01-preview').key1)]",
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('Storage_Account_Name'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('Storage_Account_Name')),'2015-05-01-preview').key1)]",
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('Storage_Account_Name'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('Storage_Account_Name')),'2015-05-01-preview').key1)]",
"WEBSITE_CONTENTSHARE": "[concat(parameters('Functions_App_Name'),'_files')]",
"WEBSITE_NODE_DEFAULT_VERSION": "6.5.0"
}
},
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('Functions_App_Name'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('Storage_Account_Name'))]"
],
"properties": {
"cors": {
"allowedOrigins": [
"[concat('https://',parameters('Storage_Account_Name'),'.blob.core.windows.net')]"
]
}
}
}
]
}
]
}
So typically, after spending a day or so trying to find out what's wrong before breaking down and resorting to asking SO, as soon as I do I find out what's wrong.
The issue is not the WEBSITE_CONTENTAZUREFILECONNECTIONSTRING but the WEBSITE_CONTENTSHARE. This has an underscore in it and underscores are not allowed in the naming convention of Storage Account File shares.
So, mental note, when I see an error like There was a conflict..., think ...with a naming convention, not ...with an existing resource.
I did also have to add the 3 Azure URLs to the CORS AllowedOrigins section
"https://functions.azure.com",
"https://functions-staging.azure.com",
"https://functions-next.azure.com"
Not sure if it's directly related to the issue, but I suggest making your template more similar to what the Portal uses by default. To see this:
Start the process of creating a new function app in Azure Portal
Enter some arbitrary App name and Resource Group
Click at the 'Automation options' link at the bottom
You'll get the full strict that it uses. It looks like this:
{
"parameters": {
"name": {
"type": "string"
},
"storageName": {
"type": "string"
},
"location": {
"type": "string"
},
"subscriptionId": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2016-03-01",
"name": "[parameters('name')]",
"type": "Microsoft.Web/sites",
"properties": {
"name": "[parameters('name')]",
"siteConfig": {
"appSettings": [
{
"name": "AzureWebJobsDashboard",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageName')), '2015-05-01-preview').key1)]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageName')), '2015-05-01-preview').key1)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~1"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageName')), '2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[concat(toLower(parameters('name')), 'a66e')]"
},
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "6.5.0"
}
]
},
"clientAffinityEnabled": false
},
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageName'))]"
],
"location": "[parameters('location')]",
"kind": "functionapp"
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('storageName')]",
"location": "[parameters('location')]",
"properties": {
"accountType": "Standard_LRS"
}
}
],
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0"
}
TLDR;
Check if the storage account name is correct & only in lowercase letters.
Longer version
github issue - https://github.com/Azure/azure-cli/issues/14518#issuecomment-665255337
In my scenario I was setting up a new Resource Group, new App Service Plan & new Function - however with existing Storage Account and ran into this issue There was a conflict. The remote server returned an error: (400) Bad Request.
My issue was with my parameter file that had a casing issue in the Storage Account name. myownstorageaccountTest instead of myownstorageaccounttest
The ARM template deployment was attempting to create a new storage account with this name myownstorageaccountTest when this myownstorageaccounttest already exists. Storage account names need to be unique across azure.
Storage Account Name requirement:
The name must be unique across all existing storage account names in Azure. It must be 3 to 24 characters long, and can contain only lowercase letters and numbers.
TL;DR: Function App name must be 59 chars or less
Because these names form a hostname, I typically append random digits to fill out to the max of whatever the limit is, which I believe is documented to be 60 characters.
During the Function App creation wizard, entering a name of 61 characters properly rejects the name right in the form:
The error message of "Must be fewer than 60" is the same as "59 or less", but entering exactly 60 - which I've seen elsewhere - allows the process to continue:
Continuing to create the Function App eventually fails with this error:
{
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"message": "There was a conflict. The remote server returned an error: (400) Bad Request."
}
]
}
Using a name of 59 chars creates OK.
This feels like a fencepost error in the form, where it accepts entry of a name that's one character larger than downstream processes will accept.
My Azure Deployment especially for the Function App also fails due to these appsettings. Here is an excerpt of my ARM script.
"siteConfig": {
"appsettings": [
{
"name": "AzureWebJobsDashboard",
"value": "[Concat('DefaultEndpointsProtocol=https;AccountName=',variables('StorageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('StorageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value)]"
},
]
The value is used for the following settings: AzureWebJobsDashboard, AzureWebJobsStorage, WEBSITE_CONTENTAZUREFILECONNECTIONSTRING.
Depends on for my storage account is also set in the ARM script.
I'm starting the deployment via Visual Studio Team Services. Here I get my mistake. I get the error message directly from Azure.
Resource: Azure-Function-Dev
Type: Microsoft.Web/sites
Status: BadRequest
{
"error": {
"code": "InternalServerError",
"message": "There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 44444-4444..."
}
}
If the Function App is redeployed again - without any changes - the deployment always works. Strange behaviour.
I then set my value to a fixed value using my parameters. Since then the deployment runs without problems. This may not be a technically clean solution, but the error can be analyzed
"siteConfig": {
"appsettings": [
{
"name": "AzureWebJobsStorage",
"value": "[parameters('AzureWebJobsStorage')]"
}, ]

Resources