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.
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.
I'm trying to update the region of the created azure management api service instance using the rest api.
URL -
https://management.azure.com/subscriptions/b0474e6c-9d1c-4b84-87f5-27ef6aad5e5e/resourceGroups/res1/providers/Microsoft.ApiManagement/service/cloud1?api-version=2017-03-01
Body
{
"parameters": {
"serviceName": "cloud1",
"resourceGroupName": "res1",
"api-version": "2017-03-01",
"subscriptionId": "b0474e6c-9d1c-4b84-87f5-27ef6aad5e5e",
"parameters": {
"location": "North Central US"
}
},
"responses": {
"200": {
"id": "/subscriptions/b0474e6c-9d1c-4b84-87f5-27ef6aad5e5e/resourceGroups/res1/providers/Microsoft.ApiManagement/service/cloud1",
"name": "",
"type": "Microsoft.ApiManagement/service",
"tags": {},
"location": "Central US",
"etag": "AAAAAACYO/A=",
"properties": {
"publisherEmail": "",
"publisherName": "",
"notificationSenderEmail": "apimgmt-noreply#mail.windowsazure.com",
"provisioningState": "Succeeded",
"targetProvisioningState": "",
"createdAtUtc": "2017-02-14T04:33:06.0312071Z",
"gatewayUrl": "https://cloud1.azure-api.net",
"portalUrl": "https://cloud1.portal.azure-api.net",
"managementApiUrl": "https://cloud1.management.azure-api.net",
"scmUrl": "https://cloud1.scm.azure-api.net",
"hostnameConfigurations": [],
"staticIps": [
"40.66.160.152"
],
"additionalLocations": null,
"virtualNetworkConfiguration": null,
"customProperties": null,
"virtualNetworkType": "None"
},
"sku": {
"name": "Developer",
"capacity": 1
}
}
}
}
Headers
Authorization Bearer
Content-Type application/json
I'm getting below error.
{
"error": {
"code": "InvalidRequestContent",
"message": "The request content was invalid and could not be deserialized: 'Could not find member 'parameters' on object of type 'ResourceDefinition'. Path 'parameters', line 2, position 15.'."
}
}
Am I doing anything wrong??
The payload is invalid, it should be the same as with service creation:
{
"location": "westus",
"properties": {
"publisherEmail": "...",
"publisherName": "..."
},
"sku": {
"name": "Developer",
"capacity": 1
}
}
But on top of that it is not supported to change master region of APIM service, you'll have to create new service and delete old one.
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')]"
}, ]
There is ARM template for provisioning two Azure Search services
"resources": [
{
"type": "Microsoft.Search/searchServices",
"name": "[parameters('serviceName')]",
"apiVersion": "[parameters('serviceApiVersion')]",
"location": "[parameters('location')]",
"properties": {
"sku": {
"name": "[parameters('sku')]"
},
"replicaCount": 1,
"partitionCount": 1,
"hostingMode": "[parameters('hostingMode')]"
}
},
{
"type": "Microsoft.Search/searchServices",
"name": "[concat(parameters('serviceName'), 'secondary')]",
"apiVersion": "[parameters('serviceApiVersion')]",
"location": "[parameters('location')]",
"properties": {
"sku": {
"name": "[parameters('sku')]"
},
"replicaCount": 1,
"partitionCount": 1,
"hostingMode": "[parameters('hostingMode')]"
}
}]
Deployment of ARM Template provisions one search service and fails another with response:
{
"error": {
"code": "Unknown",
"message": "There was a conflicting update. No change was made to the resource from this request. RequestId: b65a51b5-cd87-4dc5-82d9-9041ddd1c2dc",
"target": null,
"details": null
}
}
Does anyone face issue like that?
Perhaps search services cannot be concurrently provisioned in the same resource group. Try adding a "dependsOn" property to the second search service.
The issue
The search services don't rely on another, so a dependsOn property wouldn't be required.
I think the problem is that your arm syntax is invalid.
I don't know which apiVersion you are using, but I cannot find any that has the same syntax...
(it resembles 2015-02-28 the most, but the hostingMode field is not allowed there).
Solution
Either use apiVersion 2015-02-28 without hostingmode or (if you need that field) use a newer apiVersion where "sku" is taken outside the "properties". The following works for me!
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Search/searchServices",
"name": "parameters('serviceName')",
"apiVersion": "2015-08-19",
"location": "parameters('location')",
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"hostingMode": "default"
},
"sku": {
"name": "basic"
}
},
{
"type": "Microsoft.Search/searchServices",
"name": "[concat(parameters('serviceName'), 'secondary')]"
"apiVersion": "2015-08-19",
"location": "parameters('location')",
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"hostingMode": "default"
},
"sku": {
"name": "basic"
}
}]
}