I created an app with looopback v4. it is deployed on a GCP.
with the following yaml file
runtime: nodejs8
env_variables:
SQL_USER: [REDACTED]
SQL_PASSWORD: [REDACTED]
SQL_DATABASE: [REDACTED]
INSTANCE_CONNECTION_NAME: [REDACTED]
beta_settings:
cloud_sql_instances: [REDACTED]
The datasource json config file for the loopback v4 repository is
{
"name": [REDACTED],
"connector": "mysql",
"url": "",
"host": "ip",
"port": 3306,
"user": [REDACTED],
"password": [REDACTED],
"database": [REDACTED]
}
the datasource and the repository are automatically configured with the CLI of loopback and in local environment on my pc is working ok.
After the deploy I changed the datasource json config file because I know that I cannot use the public IP of the google cloud db so I switched with the connection instance name
{
"name": [REDACTED],
"connector": "mysql",
"url": "",
"host": [REDACTED],
"port": 3306,
"user": [REDACTED],
"password": [REDACTED],
"database": [REDACTED]
}
but it didn't work. I even use "socketPath" instead of IP (because that was the name in loopback3)
Related
I'm currently working on an Alexa Smarthome skill which can handle a multitude of device types, one of which type is an HVAC device. The server handling Skill requests is unable to handle multiple requests at a time, so instead of letting Alexa call "ReportState", I instead give it a "ChangeReport" when values change.
I'm using an Alexa.ThermostatController interface v3 capability as well as a PowerController, a TemperatureSensor, and an EndpointHealth capability to build the device. An example Discovery response looks like the following:
{
"endpointId": "12-34",
"manufacturerName": "Sample Manufacturer",
"description": "HVAC Control",
"friendlyName": "Office Test HVAC",
"additionalAttributes": {
"manufacturer": "Sample Manufacturer",
"model": "unknown",
"serialNumber": "unknown",
"firmwareVersion": "unknown",
"softwareVersion": "unknown",
"customIdentifier": "12-34"
},
"displayCategories": [
"THERMOSTAT",
"TEMPERATURE_SENSOR"
],
"cookie": {},
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
},
{
"type": "AlexaInterface",
"interface": "Alexa.EndpointHealth",
"version": "3",
"properties": {
"supported": [
{
"name": "connectivity"
}
],
"proactivelyReported": true,
"retrievable": false
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.ThermostatController",
"version": "3.1",
"properties": {
"supported": [
{
"name": "upperSetpoint"
},
{
"name": "lowerSetpoint"
},
{
"name": "thermostatMode"
}
],
"proactivelyReported": true,
"retrievable": false
},
"configuration": {
"supportedModes": [
"OFF",
"HEAT",
"COOL",
"AUTO"
]
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.TemperatureSensor",
"version": "3",
"properties": {
"supported": [
{
"name": "temperature"
}
],
"proactivelyReported": true,
"retrievable": false
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.PowerController",
"version": "3",
"properties": {
"supported": [
{
"name": "powerState"
}
],
"proactivelyReported": true,
"retrievable": false
}
}
]
}
Discovery will find the device and add it to the Alexa Home. However, when I go to the device in the app, it will not display the interface and instead say something along the lines of "Waiting for " and show a loading icon. When I go to set the thermostat by voice, such as "Set Office Test HVAC to 74 Degrees Fahrenheit", it says that the device "doesn't support that".
Does anyone know what's going on or how to fix this?
I checked the Cloudwatch logs to see if there was anything being sent from Alexa such as a ReportState directive, but could not find anything. I also tried setting a value on the thermostat to force a ChangeReport, and the ChangeReport seems to have been sent, but there's no update in the app. I have also been unable to find any errors in the Cloudwatch logs. I've checked over the responses and the Discovery message several times just to be sure, and I'm still not sure what the problem is.
I'm trying to get the HVAC device to show up in the app with the proper interface and allow users to control the device.
I had this issue with the version 3.1. I would suggest to change the version of Alexa.ThermostatController capability from 3.1 to 3.0. Also remember that the smart home capabilities used for your skill should mimic and map to physical buttons on your device.
Followed steps documented to enable bot sso
Created a bot.
Added Microsoft Teams under Channels.
Under Configuration added the messaging endpoint. e.g. (https://myproxy.proxyapp.com/teams/app/activity).
Generated a client secret for the Microsoft app id.
Added "https://token.botframework.com/.auth/web/redirect" as the Redirect URI for Web platform under Authentication for my Microsoft App.
Under API Permissions for my Microsoft App added "email offline_access openid profile". "User.Read" was available by default.
Under Expose an API added "api://botid-{Microsoft app id}". Added scope "access_as_user". Added web (1fec8e78-bce4-4aaf-ab1b-5451cc387264) and desktop (5e3ce6c0-2b1f-4285-8d4b-75ee78787346) client applications.
In the Manifest file for my Microsoft app updated "accessTokenAcceptedVersion": 2.
For my bot added an OAuth Connection as below
Created an app on Microsoft Teams and associated my Micorsoft App Id as the bot id. Attached is the manifest for my Microsoft Teams app.
When I install this app to Microsoft Teams the bot is shown in the chat tab which is expected. Further the document says as a 1st step
"The bot sends a message with an OAuthCard that contains the tokenExchangeResource property.". How can I achieve this?
When I type "Hi" for the very 1st time on the bot I receive the below JSON at my messaging endpoint
{
"text": "hi",
"textFormat": "plain",
"attachments": [
{
"contentType": "text/html",
"content": "<div>hi</div>"
}
],
"type": "message",
"timestamp": "2021-10-05T18:27:21.5454867Z",
"localTimestamp": "2021-10-05T23:57:21.5454867+05:30",
"id": "1633458441515",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/in/",
"from": {
"id": "29:1kR5UGDG5iTFhsVadKAadeYuzsLEhMYK_YFxb7_Y62nAilJVLIMiPtC8oLrGGyK7wZTaFc8-jlVxJq3q0bpoBMw",
"name": "Ashish Sood",
"aadObjectId": "3836************************be046"
},
"conversation": {
"conversationType": "personal",
"tenantId": "1734*************************bb8ecf",
"id": "a:1xMOdsbv02hfl2J4GUGA7-WemaLGCOxFlzsSNcQ9StjIMAAKn64tJ0zxKk25b02NMTl3rc7nbNffMZGXVYfraNIDKnptC01oeLRv7Ngh2WMCyOrmBT2KaDleQXSU2s4MY"
},
"recipient": {
"id": "28:18c9**********************02b9",
"name": "NOW_Virtual_Agent_SSO_Bot"
},
"entities": [
{
"locale": "en-GB",
"country": "GB",
"platform": "Mac",
"timezone": "Asia/Calcutta",
"type": "clientInfo"
}
],
"channelData": {
"tenant": {
"id": "1734************************b8ecf"
}
},
"locale": "en-GB",
"localTimezone": "Asia/Calcutta"
}
How do I use this JSON to complete the 6 steps mentioned at
add sso authentication
Microsoft Teams App manifest.json
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.11/MicrosoftTeams.schema.json",
"manifestVersion": "1.11",
"version": "1.0.0",
"id": "9a83***************************177d",
"packageName": "com.microsoft.teams.devapp",
"developer": {
"name": "SSO Bot App",
"websiteUrl": "https://www.teams.com",
"privacyUrl": "https://www.teams.com/privacy",
"termsOfUseUrl": "https://www.teams.com/termsofuse"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "SSO Bot App",
"full": "SSO Bot App"
},
"description": {
"short": "SSO Bot App",
"full": "SSO Bot App"
},
"accentColor": "#FFFFFF",
"staticTabs": [
{
"entityId": "conversations",
"scopes": [
"personal"
]
},
{
"entityId": "about",
"scopes": [
"personal"
]
}
],
"bots": [
{
"botId": "18c9**********************02b9",
"scopes": [
"personal"
],
"supportsFiles": true,
"isNotificationOnly": false
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"token.botframework.com"
],
"webApplicationInfo": {
"id": "18c9**********************02b9",
"resource": "api://botid-18c9**********************02b9"
}
}
We ran into the same issue and spit through the nodejs/.net bot framework code to find what JSON is exactly sent for an OAuth card. We ended up with the follow JSON:
{
"attachments": [
{
"content": {
"connectionName": "<name of your sso oauth connection>",
"text": "<some text, is not shown>",
"tokenExchangeResource": {
"id": "<some random id, for validation in invoke request>"
}
},
"contentType": "application/vnd.microsoft.card.oauth"
}
],
"channelId": "msteams",
"conversation": {
"id": "<conversation ID>"
},
"from": {
"id": "<your conversation bot id>"
},
"recipient": {
"id": "<conversation user id>"
},
"serviceUrl": "<service URL of conversation>",
"type": "message"
}
I would like to deploy ARM templates individually rather than linked templates/nested templates/multiple resources.
Ex: Deploy a Sql Server and database
I created individual templates for Sql Server and Sql database . I deployed successfully and its working fine.
Deploy Sql Server ARM template(Specifically designed only for sql server)
Deploy Sql Server Database(Specifically designed only for sql database with above sql server name mentioning in parameters file)
While deploying Sql database arm template , I had specified accurate sql server name(deployed in Step1) in parameters file of step2 but I did not mentioned "dependson" parameter in resource section and directly deployed .Database creation successfully under the resource group I selected while deployment process.
My Query:
How can I make sure Sql database arm template is deploying under specific server name(Step1) only without dependson parameter?
or
How to use existing reference resource id in resources section without dependson?
Will output of step1(resourceid) of sql server will be any helpful?
Sql ARM Template Deploy JSON:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
"collation": {
"type": "string",
"defaultValue": "SQL_Latin1_General_CP1_CI_AS",
"metadata": {
"description": "The collation of the database."
}
},
"edition": {
"type": "string",
"metadata": {
"description": "The edition of the database. The DatabaseEditions enumeration contains all the valid editions. e.g. Basic, Premium."
},
"defaultValue": "Basic"
},
"sqlservername": {
"type": "string",
"metadata": {
"description": "The name of the sql server."
}
},
"databasename": {
"type": "string",
"metadata": {
"description": "The name of the database to be operated on (updated or created)."
},
"minLength": 7,
"maxLength": 128
},
"maxSizeBytes": {
"type": "string",
"metadata": {
"description": "The max size of the database expressed in bytes."
}
},
"serviceobjectivename": {
"type": "string",
"metadata": {
"description": "The configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database."
},
"defaultValue": "Basic"
},
"tagsArray": {
"type": "object",
"metadata": {
"description": "Resource Tags helps to indentify the use of service"
}
}
},
"functions": [],
"variables": {
"sqldatabasename": "[concat(parameters('sqlservername'),'/',parameters('databasename'))]"
},
"resources": [
{
"name": "[variables('sqldatabasename')]",
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2014-04-01",
"location": "[parameters('location')]",
"tags": "[parameters('tagsArray')]",
"properties": {
"collation": "[parameters('collation')]",
"edition": "[parameters('edition')]",
"maxSizeBytes": "[parameters('maxSizeBytes')]",
"requestedServiceObjectiveName": "[parameters('serviceobjectivename')]"
}
}
],
"outputs": {
"sqldatabaseresourceId": {
"type": "object",
"value": "[reference(resourceId('Microsoft.Sql/servers/databases',parameters('sqlservername'), parameters('databasename')),'2014-04-01')]"
}
}
}
Template Parameters:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"tagsArray": {
"value": {
"Environment": "POC"
}
},
"servername": {
"value": "sql-test"
},
"sqlAdministratorLogin": {
"value": "sqladmin"
},
"sqlAdministratorLoginPassword": {
"value": "myPassword586#"
},
"firewallIpAddresses": {
"value": [
{
"start": "1.1.1.0",
"end": "1.1.1.1",
"clientName": "Clienttest1"
},
{
"start": "1.2.3.4",
"end": "1.2.3.16",
"clientName": "Clienttest2"
}
]
},
"location": {
"value": ""
}
}
}
It is important to understand that dependsOn enables you to define one resource as dependent on one or more resources within your template only, and should not be used to map relationships between your resources. As explained in the ARM Template documentation, dependsOn isn't the right approach to document how resources are interconnected.
How can I make sure Sql database arm template is deploying under specific server name(Step1) only without dependson parameter?
Microsoft.Sql/servers/databases is a child resource of Microsoft.Sql/servers, and it is the name of the child resource that defines the connection with the parent resource.
You would have had to set the dependsOn property if you were deploying the child resource after the parent resource in the same ARM template, since an implicit deployment dependency isn't automatically created between them. Specifying dependsOn in this case would ensure that the parent resource is deployed (and exists) before the child resource.
That said, when defined outside of the parent resource, you format the type and name with slashes to include the parent type and name.
"type": "{resource-provider-namespace}/{parent-resource-type}/{child-resource-type}",
"name": "{parent-resource-name}/{child-resource-name}",
So, a SQL Database might be defined as:
{
"type": "Microsoft.Sql/servers/databases",
"name": "[concat(variables('sqlServerName'), '/', parameters('databaseName'))]",
...
Coming to your next question:
How to use existing reference resource id in resources section without dependson?
Will output of step1(resourceid) of sql server will be any helpful?
As you have already deployed the parent resource (DB Server) in a different template, don't set a dependency. Instead, deploy the child resource (Database) to the same resource group and provide the name of the parent resource. That should suffice.
Example:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sqlServerName": {
"type": "string",
"defaultValue": "sqlserver"
},
"databaseName": {
"type": "string",
"defaultValue": "mydb"
}
},
"resources": [
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2014-04-01",
"name": "[concat(parameters('sqlServerName'), '/', parameters('databaseName'))]",
"location": "[resourceGroup().location]",
"properties": {
"collation": "SQL_Latin1_General_CP1_CI_AS",
"edition": "Basic"
}
}
],
"outputs": {}
}
I started to learn angular and created a simple project in Visual Studio and it ran fine there. It is only one html file and a separate JS file. I decided to try Visual Studio Code as this looks like a better environment to code in for front end work.
But for the life of me I cannot get the Chrome debugger to display the page.
Here is the current launch.json (tried several changes to url and webroot to no luck):
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:9222/index.html",
"webRoot": "${workspaceRoot}"
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"webRoot": "${workspaceRoot}"
}
]
}
I can get chrome to launch and connect but I get a completely blank page. I can then go to Localhost/json which gives me this:
[ {
"description": "",
"id": "2c0aed08-5bf3-4186-9ad6-9af1bc9e500c",
"title": "localhost:9222/index.html",
"type": "page",
"url": "http://localhost:9222/json"
}, {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/ccfbea86-ec75-434e-9ae0-749eba4cbf2b",
"id": "ccfbea86-ec75-434e-9ae0-749eba4cbf2b",
"title": "Chrome Media Router",
"type": "background_page",
"url": "chrome-extension://pkedcjkdefgpdelpbcmbmeomcjbeemfm/_generated_background_page.html",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/ccfbea86-ec75-434e-9ae0-749eba4cbf2b"
} ]
I have no clue at this point what to try or really how to debug or look at what might be causing this. Any help or direction would be greatly appreciated.
I am not sure this is the correct answer. But changing the launch.json to include the file itself worked. I can now debug and view my pager in the browser window. Also turning on the diagnosticLogging allowed me to see the how it was doing some of the mapping.
{
"name": "Launch Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:9222/",
"webRoot": "${workspaceRoot}\\",
"file": "${workspaceRoot}/index.html",
"diagnosticLogging": true
}
Is there a provision for AAD authentication in Logic App's http connector?
If so, how will the authentication object look like?
Or do I have to acquire the AAD token separately and then populate the same in http connector's header section?
Logic Apps support ActiveDirectoryOAuth authentication natively, using either client secret or certificate + password
Below are the schemas for both
"simpleAction": {
"type": "http",
"inputs": {
"uri": "https://www.endpoint.com/certificate",
"method": "GET",
"authentication": {
"type": "ActiveDirectoryOAuth",
"authority": "",
"tenant": "",
"audience": "",
"clientId": "",
"pfx": "",
"password": ""
}
},
},
"simpleAction2": {
"type": "http",
"inputs": {
"uri": "https://www.endpoint.com/secret",
"method": "GET",
"authentication": {
"type": "ActiveDirectoryOAuth",
"authority": "",
"tenant": "",
"audience": "",
"clientId": "",
"secret": ""
}
},
}
This is similar to Azure Scheduler authenticatin object, which is documented here
https://azure.microsoft.com/en-us/documentation/articles/scheduler-outbound-authentication/#request-body-for-activedirectoryoauth-authentication