Unable to assign LUIS az accounts to LUIS apps via REST - azure-language-understanding

The luis resources that I created aren't showing up in the Luis portal (posted a question here) so decided to use the REST APIs to configure things manually. With the REST endpoints I was able to import apps. However, I wasn't able to add LU resource to the imported apps despite that the APIs return success.
Below is the call.
POST https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/<appid>/azureaccounts
{
"azureSubscriptionId": "<id>",
"resourceGroup": "<rg name>",
"accountName": "<resource name>"
}
returns 201 CREATED
{
"code": "Success",
"message": "Operation Successful"
}
However, a subsequent GET call returns empty result.
GET https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/<appid>/azureaccounts
tried the GET call a couple hours after and it is still returning empty result. What is going on?

It sounds like there's something wrong with your azure account and/or your luis.ai account. There are two places to raise support requests to handle these types of matters. First is uservoice on LUIS.ai:
While issues raised here are typically routed back to the bot framework support team, once there, they can be escalated.
Secondly, you can raise the issue in Azure:
You can follow this link HERE to get to that blade quickly.

Related

Google Calendar API request is denied for scope https://www.googleapis.com/auth/calendar.app.created

My app needs to create a Google Calendar and manage events in it for users. Google API Console allows to create a consent form for this scope:
https://www.googleapis.com/auth/calendar.app.created
It is supposed to allow creation of secondary calendars and events in those calendars. Description reads:
Make secondary Google calendars, and see, create, change, and delete
events on them
However, after a user gives permission through the consent form etc, I am getting PERMISSION_DENIED when I try to create a calendar (I am using the REST api https://www.googleapis.com/calendar/v3/calendars)
{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"errors": [
{
"message": "Insufficient Permission",
"domain": "global",
"reason": "insufficientPermissions"
}
],
"status": "PERMISSION_DENIED"
}
}
My code and the rest of the plumbing (authorization code, access token etc) works because if I use this scope:
https://www.googleapis.com/auth/calendar
I am able to create the calendar.
So, anybody knows if https://www.googleapis.com/auth/calendar.app.created is deprecated or something? It is not listed in the V3 calendar documentation but I was hopping that it continue to work. I hate to ask the user for full permission to all calendars since I only want to create and access a secondary calendar and that scope supposed to do exactly what I need.
Thoughts?
As you can see under OAuth 2.0 Scopes for Google APIs, https://www.googleapis.com/auth/calendar.app.created is not a valid scope for Calendar API v3.
The documentation for Calendars:insert states that the only valid scope for creating a new calendar is https://www.googleapis.com/auth/calendar
You notice yourself that if you try to create a calendar with https://www.googleapis.com/auth/calendar.app.created - be it on OAuth2 playground or elsewhere - the request fails with a 403 error
CONCLUSION
Unfortunately https://www.googleapis.com/auth/calendar.app.created is not a valid scope, the acceptance of this scope on OAuth2 playground is a bug.
https://www.googleapis.com/auth/calendar.app.created might not seem as valid scope - but works for me.
Successfully could create new calendar with that scope, then manage events within it, and calendar itself appears on list of calendars in calendar.google.com
Can't really help much without knowing exactly the flow you have on creating and executing requests to google. Also keep in mind it worked for me with server side app. Using latest library provided by google for PHP.

Post message to MS Teams channel using Graph API

I'm trying to send a message to MS Teams using Graph API. I'm passing access token (AAD token) with it but still, it's giving me below error. I have given all the required permissions in Azure API permissions.
error:
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"request-id": "53a5aaff-3d39-42ce-bdc6-74d02a756be2",
"date": "2019-12-23T06:42:27"
}
}
}
API: https://graph.microsoft.com/beta/teams/{group-id-for-Teams}/channels/{channel-id}/messages/{message-id}/replies
Oh, if this is from a bot (not clear from the original question, but clarified in your later comment) then you don't need to use the Graph API at all - there's another way to send the message using the Bot Framework tools instead. You can do this either from within your bot, or from a different application altogether. I've got a few bots where the user schedules something, like when they want a message sent, where the bot saves it to a database and I have another application (mostly I use Azure Functions right now) to send the item on that schedule.
There are some important pieces of information you need to store though, which you can get any time the users sends your bot a message - it's the information you need to store so that you know how to connect directly to that user and that conversation. It's called Pro-active Messaging, and to see how to do this, see the answer I posted at Programmtically sending a message to a bot in Microsoft Teams
If you DON'T have any conversation history with the user ever (as in they have never spoken with your bot before, and you're trying to send the first message) then it gets more complicated... Let me know if that's the case though.
Sending message to a channel using graph api is a protected api and it needs access permission from Microsoft.
Access can be requested from Microsoft access reuqest form.
Once access is given from Microsoft add graph api in api permissions of your web app, and bingo you can get the response.

Luis: Access denied due to invalid subscription key

I am facing following issue when i try to update application on Luis using following request:
https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/app-id-here
header:
Ocp-Apim-Subscription-Key:paid-subscription key
body:
{
"name": "Name of luis app",
"description": "string"
}
I am getting following error:
{
"statusCode": 401,
"message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription."
}
I am using paid subscription from Azure portal with westus region. Still facing this issue.
However, This key works when I try to get top scoring intent using following request:
https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/luis-app-id?subscription-key=subscription-key-azure&timezoneOffset=-360&q=hi
This is really weird as sunscription key works for GET request but not for PUT or POST request.
Any suggestions?
PS: I am using paid subscription key.
The (subscription) keys created with a Cognitive Service LUIS resource in Azure Portal, even when added to with Assign resource in luis.ai, can only be used for runtime queries on a defined app.
The authoring endpoints on LUIS Programmatic APIs v2.0 - to create and manage apps and their elements - can only be used with the Authoring Key available in the luis.ai portal.
More information can be found in Authoring and query prediction endpoint keys in LUIS
It looks like you have two issues you are working thru here.
First, the API you are trying to post to should read "https://[location].api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/publish". From the looks of it, you are missing the 'publish' at the end of your API call.
Second, the paid subscription key needs to be added to your LUIS app. Can you confirm it has been added? If not, follow these steps to do so:
Click Manage => Keys and Endpoints.
Next, click 'Assign resource'.
A window will pop up allowing you to select the tenant, subscription, and the key to use.
Click OK.
Click 'Publish' to make the newly generated endpoint accessible.
Make sure you add subscription primary key value in my request and also make sure you have associated your API with the product which you used the Primary key

Error when Sending Messages to Skype for Business Bot Framework Bot

I'm having an issue with a Skype for Business bot in one of my Office 365 tenants. I have multiple tenants and in the first one I was able to add a Skype for Business bot framework bot with no issues. It took awhile for the bot to show up in the directory but it worked. In my second tenant, when I add the bot and attempt to send messages to it (even after 12ish hours of waiting), Skype for Business shows an error under each message I try to send to it - "The action couldn’t be completed. Please try again later." Any ideas what might be going on? One difference between the tenants is that the tenant that isn't working ha a custom domain name, and is using Azure AD Synchronization. Based on some tips I saw I made the address of my bot sip:username#mytenant.onmicrosoft.com rather than using my custom domain name. That didn't seem to make a difference... anyone else encountered this/have any ideas? I also tried leaving off the [BotAuthentication] tag on my MessagesController and that did not make a difference as well.
EDIT: Could this have something to do with my custom domain being federated? That's why I went with mytenant.onmicrosoft.com for the username of the bot.
I was able to resolve this. It seems like it has something to do with when you add a bot to a federated domain utilizing the custom domain name. This errors out when you use the New-CsOnlineApplicationEndpoint -Uri bot#domain.com. However, it still creates a bad endpoint. The cmdlet does not error out if you use a uri like bot#domain.onmicrosoft.com. However, after I had already added the bad endpoint, it seemed like no endpoints would work after that. To resolve, I removed all endpoints, including the first bad one with the uri bot#domain.com. Waited 8 hours, added a single endpoint using the onmicrosoft.com Office 365 domain, waited probably about 12 hours, and it started working.

Google Classroom API modifyAttachments

When executing the courses.courseWork.studentSubmissions.modifyAttachments method in the Google Classroom API, a 403 error is returned when I try to add the attachment to the student's submission.
GoogleJsonResponseException:
{
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "#ProjectPermissionDenied The Developer Console project is not permitted to make this request.",
"reason" : "forbidden"
} ],
"message" : "#ProjectPermissionDenied The Developer Console project is not permitted to make this request.",
"status" : "PERMISSION_DENIED"
}
The call is being made from an authenticated student account and being added as a Link resource. The Developer Console project DOES have the Google Classroom API enabled, and other calls to the Google Classroom API are working fine, such as courses.list and courses.courseWork.studentSubmissions.get. What am I missing? The same error is returned when using the Try it! app in the Google Classroom documentation site.
When modifying assignments/courseWork or student submissions, only the Developer console project that created those objects can modify them. This means that only projects that created the corresponding course work can modify them, otherwise a 403 PERMISSION_DENIED error is returned. You can easily determine if the course work item is associated with the Developer Console project making the request by checking the associatedWithDeveloper property on the Google Classroom course work response.
It took me a while to figure this out myself, but the best way to go in my opinion is to first create the coursework (i.e. assignment or question) itself with Google Script or using the Classroom API. The coursework is then associated with the correct console project and you are cleared to manage the submissions from thereon.
All Classroom API methods may return a PERMISSION_DENIED (HTTP 403) error if an end user does not meet prerequisites for access. The message accompanying the error contains an error message to help you identify the cause and direct users to take the appropriate action.
ProjectPermissionDenied indicates that the request attempted to modify a resource associated with a different Developer Console project.
Possible Action: Indicate that your application cannot make the desired request. It can only be made by the Developer Console project of the OAuth client ID that created the resource.

Resources