ARM Template unable to set $connections - validation

I have created an ARM template in Visual Studio project with connection to slack. When I connect to slack in Azure portal - everything is fine. My slack API connection is authorized and works. My problem is with deployment and setting $connections.
Here is my template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
<template-params>
},
"variables": {
"slack": "[concat(parameters('appPrefix'), '-slack-', parameters('environment'))]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"location": "[resourceGroup().location]",
"name": "[variables('slack')]",
"properties": {
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/slack')]"
},
"displayName": "Slack",
"parameterValues": {}
}
},
{
"name": "[parameters('logicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "LogicApp"
},
"apiVersion": "2016-06-01",
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Collecting_went_wrong": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['slack']['connectionId']"
}
},
"method": "post",
"path": "/chat.postMessage",
"queries": {
"channel": "<channel>",
"text": "<message>",
"username": "<user>"
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"parameters": {
"$connections": {
"type": "object",
"defaultValue": {
}
}
},
"triggers": {
<trigger>
}
},
"parameters": {
"$connections": {
"value": {
"slack": {
"id": "[resourceId('Microsoft.Web/connections', variables('slack'))]",
"connectionId": "[resourceId('Microsoft.Web/connections', variables('slack'))]",
"connectionName": "slack"
}
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/connections', variables('slack'))]"
]
}
],
"outputs": {}
}
The 'fun' part is validation of template during the deployment:
New-AzureRmResourceGroupDeployment : 17:08:51 - Resource Microsoft.Logic/workflows 'reporting-reminder-logic-app-dev'
failed with message '{
"error": {
"code": "ConnectionsParameterInvalid",
"message": "The provided API connection parameter 'slack' is missing the required property 'id'."
}
}'
I'm really confused here.
What I tried to deploy it as connection and added $connection parameter definition as well, deployment went through. Nevertheless, when I changed connection to $connections in template parameters, Azure portal throw at me the same validation error.
Any idea what am I doing wrong here?
Thanks

The issue was about different ID in resources -> Microsoft/Web.connections -> properties -> id and slack -> connection. Once this connection ids were the same, the validation passed.
So it's only confusing validation message.

Related

Any idea how to do custom supportedCookingModes in Alexa discovery?

I'm trying to return a Discovery Response, but the supportedCookingModes only seems to accept standard values and only in the format of ["OFF","BAKE"], not Custom values as indicated by the documentation. Any idea on how to specify custom values?
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"payloadVersion": "3",
"messageId": "asdf"
},
"payload": {
"endpoints": [
{
"endpointId": "asdf",
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.Cooking",
"version": "3",
"properties": {
"supported": [
{
"name": "cookingMode"
}
],
"proactivelyReported": true,
"retrievable": true,
"nonControllable": false
},
"configuration": {
"supportsRemoteStart": true,
"supportedCookingModes": [
{
"value": "OFF"
},
{
"value": "BAKE"
},
{
"value": "CUSTOM",
"customName": "FANCY_NANCY_MODE"
}
]
}
}
]
}
]
}
}
}
Custom cooking modes are brand specific. This functionality is not yet publicly available. I recommend you to choose one of the existing cooking modes:
https://developer.amazon.com/en-US/docs/alexa/device-apis/cooking-property-schemas.html#cooking-mode-values

Azure Service Bus - ARM Template (Update existing Topic parameters)

I need help with the Azure service bus service. I need to create a new topic in an existing service bus service by using Visual Studio, is there any way to achieve this. Because when I try to do this, Iā€™m getting the following error:
Template deployment returned the following errors:
15:28:14 - 15:28:13 - Resource Microsoft.ServiceBus/namespaces ā€œ#######ā€ failed with message '{
15:28:14 - "error": {
15:28:14 - "message": "Namespace update failed with conflict in backend. CorrelationId: 3c155444-2c1e-525d-943f-8b25d0a1da7e",
15:28:14 - "code": "Conflict"
15:28:14 - }
Any help would be very helpful to me.
The Microsoft.Resources/deployments template allows you to update an existing resource.
Modifiying the quickstart template to allow updates looks something like this (I did remove the subscription deployment to make it a bit shorter). Keep in mind that some parameters like partitioning cannot be modified- you must delete the resource and redeploy to change them.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"service_BusNamespace_Name": {
"type": "String",
"metadata": {
"description": "Name of the Service Bus namespace"
}
},
"serviceBusTopicName": {
"type": "String",
"metadata": {
"description": "Name of the Topic"
}
},
"serviceBusSubscriptionName": {
"type": "String",
"metadata": {
"description": "Name of the Subscription"
}
},
"location": {
"defaultValue": "[resourceGroup().location]",
"type": "String",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {
"defaultSASKey_Name": "RootManageSharedAccessKey",
"authRuleResource_Id": "[resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', parameters('service_BusNamespace_Name'), variables('defaultSASKey_Name'))]",
"sbVersion": "2017-04-01"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "updateTopic",
"properties": {
"mode": "Incremental",
"parameters": {},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"apiVersion": "2017-04-01",
"name": "[parameters('service_BusNamespace_Name')]",
"type": "Microsoft.ServiceBus/namespaces",
"location": "[parameters('location')]",
"sku": {
"name": "Standard"
},
"resources": [
{
"apiVersion": "2017-04-01",
"name": "[parameters('serviceBusTopicName')]",
"type": "Topics",
"dependsOn": [
"[concat('Microsoft.ServiceBus/namespaces/', parameters('service_BusNamespace_Name'))]"
],
"properties": {
"defaultMessageTimeToLive": "P10675199DT2H48M5.4775807S",
"maxSizeInMegabytes": "1024",
"requiresDuplicateDetection": "false",
"duplicateDetectionHistoryTimeWindow": "PT10M",
"enableBatchedOperations": "false",
"supportOrdering": "false",
"autoDeleteOnIdle": "P10675199DT2H48M5.4775807S",
"enablePartitioning": "false",
"enableExpress": "false"
}
}
]
}
]
}
}
}
],
"outputs": {
"NamespaceConnectionString": {
"type": "String",
"value": "[listkeys(variables('authRuleResource_Id'), variables('sbVersion')).primaryConnectionString]"
},
"SharedAccessPolicyPrimaryKey": {
"type": "String",
"value": "[listkeys(variables('authRuleResource_Id'), variables('sbVersion')).primaryKey]"
}
}
}
Usually you get "conflict in backend" errors when you request an operation that isn't allowed in the resource's current state.
For example, once you upgrade Service Buses to Standard, deployments will fail if it tries to downgrade to Basic.
Effectively, the only solution for those cases is re-provision the resource from scratch.

Cloudformation AWS: Connect RDS to subnets

I am trying to build a cloudformation template but I have some trouble with how to connect my Oracle RDS instance with my two subnets.
My parameters are :
"3DCFDB": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"DBInstanceClass": "db.t2.micro",
"AllocatedStorage": "20",
"Engine": "oracle-se2",
"EngineVersion": "12.1.0.2.v13",
"MasterUsername": {
"Ref": "user"
},
"MasterUserPassword": {
"Ref": "password"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "*"
}
},
"DependsOn": [
"3DEXPSUBPU",
"3DSUBPRI"
]
}
What parameter am I supposed to add to connect my RDS to 2 subnets?
If I understand correctly, you need to create a resource with Type "Type": AWS::RDS::DBSubnetGroup, then inside your "Type": "AWS::RDS::DBInstance" you can refer to the subnet group with something similar to this
"3DCFDB": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"DBInstanceClass": "db.t2.micro",
"AllocatedStorage": "20",
"Engine": "oracle-se2",
"EngineVersion": "12.1.0.2.v13",
"DBSubnetGroupName": {
"Ref": "DBsubnetGroup"
}
"MasterUsername": {
"Ref": "user"
},
"MasterUserPassword": {
"Ref": "password"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "*"
}
},
"DependsOn": [
"3DEXPSUBPU",
"3DSUBPRI"
]
},
"DBsubnetGroup": {
"Type" : "AWS::RDS::DBSubnetGroup",
...
...
}
More info can be found here
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html

Logic App deployment from Visual Studio 2017 fails

I have created a Logic App in Azure which works fine in Azure itself. So I first recreated the Logic App within VS2017 (with "Azure Logic Apps for Visual Studio" extension installed). The logic app contains a trigger to read from the Azure Servicebus and calls a custom logic app connector action. This custom connector calls a SOAP webservice via an Azure Data Gateway, which runs fine.
Now the issue is that when I try to deploy it from VS2017, it complains in the Output window. The message I get is:
New-AzureRmResourceGroupDeployment : 13:41:34 - Resource MICROSOFT.WEB/CONNECTIONS 'MyCustomConnector' failed with message '{"error": {"code": "ConnectionGatewayFailure","message": "Establishing connection with the service failed with code 'BadRequest'."}}'
My Logic App works great because I receive the SOAP request in my on-premise application.
What I have tried so far:
Checked my permissions, I am now owner of the resource groups (one where the Logic App and custom connector resides in, and one where the Gateway resides in)
Copied content in: "My resource group > Settings > Automation script > Json Template" and pasted it into Visual Studio
Run Visual Studio as Administrator
Added "-DeploymentDebugLogLevel All" to my Deploy-AzureResourceGroup.ps1 file, doesn't show me anything more useful.
Troubleshoot common Azure deployment errors which says for BadRequest: "You sent deployment values that do not match what is expected by Resource Manager. Check the inner status message for help with troubleshooting." I see no inner status message.
Checked Google for a useful answer
But up until now, without success. So hopefully some of you can help me.
Edit: Here's my ARM template, I renamed a few things, hopefully not too much.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connections_servicebus_name": {
"defaultValue": "servicebus",
"type": "String"
},
"customApis_MyCustomConnector_name": {
"defaultValue": "My-Custom-Connector",
"type": "String"
},
"connections_MyCustomConnector_name": {
"defaultValue": "My-Custom-Connector",
"type": "String"
},
"workflows_MyLogicApp_name": {
"defaultValue": "My-LogicApp",
"type": "String"
},
"workflows_MyLogicApp_id": {
"defaultValue": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Logic/integrationAccounts/My-Integration-Account",
"type": "String"
}
},
"variables": {},
"resources": [
{
"comments": "Generalized from resource: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup-B/providers/Microsoft.Logic/workflows/My-LogicApp'.",
"type": "Microsoft.Logic/workflows",
"name": "[parameters('workflows_MyLogicApp_name')]",
"apiVersion": "2017-07-01",
"location": "westeurope",
"tags": {},
"scale": null,
"properties": {
"state": "Enabled",
"integrationAccount": {
"id": "[parameters('workflows_MyLogicApp_id')]"
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
},
"actions": {
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"My-Custom-Connector": {
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('connections_MyCustomConnector_name'))]",
"connectionName": "My-Custom-Connector",
"id": "[resourceId('Microsoft.Web/customApis', parameters('customApis_MyCustomConnector_name'))]"
},
"servicebus": {
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('connections_servicebus_name'))]",
"connectionName": "servicebus",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westeurope/managedApis/servicebus"
}
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/connections', parameters('connections_MyCustomConnector_name'))]",
"[resourceId('Microsoft.Web/customApis', parameters('customApis_MyCustomConnector_name'))]",
"[resourceId('Microsoft.Web/connections', parameters('connections_servicebus_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup-B/providers/Microsoft.Web/connections/My-Custom-Connector'.",
"type": "Microsoft.Web/connections",
"name": "[parameters('connections_MyCustomConnector_name')]",
"apiVersion": "2016-06-01",
"location": "westeurope",
"scale": null,
"properties": {
"displayName": "LogicAppsCustomConnector-Connection",
"customParameterValues": {},
"api": {
"id": "[resourceId('Microsoft.Web/customApis', parameters('customApis_MyCustomConnector_name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/customApis', parameters('customApis_MyCustomConnector_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup-B/providers/Microsoft.Web/connections/servicebus'.",
"type": "Microsoft.Web/connections",
"name": "[parameters('connections_servicebus_name')]",
"apiVersion": "2016-06-01",
"location": "westeurope",
"scale": null,
"properties": {
"displayName": "worker_outbound",
"customParameterValues": {},
"api": {
"id": "[concat('/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/locations/westeurope/managedApis/', parameters('connections_servicebus_name'))]"
}
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup-B/providers/Microsoft.Web/customApis/My-Custom-Connector'.",
"type": "Microsoft.Web/customApis",
"name": "[parameters('customApis_MyCustomConnector_name')]",
"apiVersion": "2016-06-01",
"location": "westeurope",
"scale": null,
"properties": {
"connectionParameters": {
"authType": {
"type": "string",
"allowedValues": [
{
"value": "none"
}
],
"uiDefinition": {
"displayName": "Authentication Type",
"description": "Authentication type to connect to your API",
"tooltip": "Authentication type to connect to your API",
"constraints": {
"tabIndex": 1,
"required": "true",
"allowedValues": [
{
"text": "none",
"value": "anonymous"
}
],
"capability": [
"gateway"
]
}
}
},
"gateway": {
"type": "gatewaySetting",
"gatewaySettings": {
"dataSourceType": "CustomConnector",
"connectionDetails": []
},
"uiDefinition": {
"constraints": {
"tabIndex": 4,
"required": "true",
"capability": [
"gateway"
]
}
}
}
},
"brandColor": "#ffffff",
"description": "Calls My SOAP test webservice.",
"displayName": "[parameters('customApis_MyCustomConnector_name')]",
"iconUri":
},
"dependsOn": []
}
]
}

Azure DF CopyFromBlob Failing

I am trying to copy files from an Azure Blob to an Azure Data Lake using a data factory. I keep running into this error and am not finding any information on what the parameter 'baseURI' maps to:
"errorCode": "2200",
"message": "ErrorCode=InvalidParameter,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=The value of the property &apos;baseUri&apos; is invalid: &apos;Value cannot be null.\r\nParameter name: baseUri&apos;.,Source=,''Type=System.ArgumentNullException,Message=Value cannot be null.\r\nParameter name: baseUri,Source=Microsoft.DataTransfer.MsiStoreServiceClient,'",
"failureType": "UserError",
"target": "CopyFromBlob"
I am using Powershell with json files. Anything obvious that I am missing here?
Azure Data Lake Linked Service
{
"name": "<redacted>",
"properties": {
"type": "AzureDataLakeStore",
"typeProperties": {
"dataLakeStoreUri": "<redacted>",
"tenant": "<redacted>",
"subscriptionId": "<redacted>",
"resourceGroupName": "<redacted>"
},
"connectVia": {
"referenceName": "<redacted>",
"type": "IntegrationRuntimeReference"
}
}
}
Azure Blob Linked Service:
{
"name": "<redacted>",
"properties": {
"type": "AzureStorage",
"typeProperties": {
"connectionString": {
"type": "SecureString",
"value": "DefaultEndpointsProtocol=https;AccountName=<redacted>;AccountKey=<redacted>"
}
},
"connectVia": {
"referenceName": "<redacted>",
"type": "IntegrationRuntimeReference"
}
}
}
Data Lake Dataset
{
"name": "<redacted>",
"properties": {
"type": "AzureDataLakeStoreFile",
"linkedServiceName":{
"referenceName": "<redacted>",
"type": "LinkedServiceReference"
},
"typeProperties": {
"folderPath": "<redacted>"
}
}
}
Blob DataSet
{
"name": "<redacted>",
"properties": {
"type": "AzureBlob",
"linkedServiceName": {
"referenceName": "<redacted>",
"type": "LinkedServiceReference"
},
"typeProperties": {
"folderPath": "<redacted>",
}
}
}
Pipeline
{
"name": "<redacted>",
"properties": {
"activities":[
{
"name": "CopyFromBlob",
"type": "Copy",
"inputs": [
{
"referenceName": "<redacted>",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "<redacted>",
"type": "DatasetReference"
}
],
"typeProperties": {
"source": {
"type": "BlobSource"
},
"sink": {
"type": "AzureDataLakeStoreSink"
}
}
}]
}}
Powershell does the following:
1. Create Data Factory
2. Create Azure Integration Runtime
3. Create Azure Data Lake Linked Service
4. Create Azure Blob Linked Service
5. Create Azure Blob Dataset
6. Create Azure Data Lake Dataset
7. Create pipeline
8. Invoke pipeline
Check your Azure Integration Runtime powershell command - are you defining a location and type? I ran into a very similar error (my null parameter was 'dictionary') when I forgot to define a location for my integration runtime.
Hope this helps!

Resources