Unable to save credential for mail channel on Azure - azure

I'm trying to register my bot on the email channel.
I got the error "unable to save" or "Unable to validate the given credentials. iD : anId".
If I look in the inspector I got this :
mBbZ2BiSKVEt.js?compression=gzip2:29 [Microsoft_Azure_BotService] 5:33:57 PM MsPortalFx.Base.Diagnostics.ErrorReporter 1 MsPortalFx.Base.Diagnostics.ErrorReporter: _errorData: undefined
_sourceErrorLevel: undefined
baseTypes: ["MsPortalFx.Errors.AjaxError","MsPortalFx.Errors.Error"]
code: undefined
data: {"type":"POST","requestId":"myId","sessionId":"mySessionId","status":404,"statusText":"error","duration":40.30000000074506}
errorLevel: 2
errorThrown:
extension: Microsoft_Azure_BotService
handled: undefined
innerErrors: []
jqXHR: {"readyState":4,"responseText":"Cannot POST /api/ClientTrace?defaultCloudName=azure&extensionName=Microsoft_Azure_BotService&pageVersion=1.0.0.32&l=en.en-us&trustedAuthority=portal.azure.com&cacheability=3\n","status":404,"statusText":"error"}
message: ajaxExtended call failed
name: Error
source: undefined
stack: null
textStatus: error
timestamp: 3814640.800000001
type: MsPortalFx.Errors.AjaxError
Is this related to my company network or something in azure ? What could I do ?
Thanks in advance
Edit : here is what I got with the github Eric provided :

the same problem was bothering me,
I tried,
onmicrosoft.com
#hotmail.com
#outlook.com
domains but no luck. Then I tried my company domain given by Mircosoft and it worked.
It's not a matter of a free Azure subscription, it's about the Office 365 subscription.

the error "unable to save" or "Unable to validate the given credentials
I can reproduce the issue on my side if I configure Email channel with other email services (not Office 365 email).
The Email channel currently works with Office 365 only. Please make sure you are using Office 365 email and entering valid Office 365 credentials.
Besides, similar issue is reported in this github issue:Configuring the Email Connector to Bot Framework, you can check it.

Related

GraphAPI returns "Resource Not Found" trying to get calendars

I am able to access the users using https://graph.microsoft.com/v1.0/users/{id}
But when I am trying to get calendars or events I am getting an Error: Resource could not be discovered
I am using the following URL
https://graph.microsoft.com/v1.0/users/{id}/events
and
https://graph.microsoft.com/v1.0/users/{id}/calendar
I do have all calendar read and write permissions in the Active directory
Can someone help me with this??
I am expecting to get all the events from the calendar
The error "Resource Not Found" usually occurs if the user doesn't have required active licenses assigned.
I tried to reproduce the same in my environment and got the results like below:
I tried to retrieve the calendar of the user with no active licenses:
I got the same error as below:
https://graph.microsoft.com/v1.0/users/{id}/calendar
I created an Azure AD application and added API permissions like below:
I generated the access token using the below parameters:
https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
client_id:clientID
client_secret:ClientSecret
scope:https://graph.microsoft.com/.default
grant_type:client_credentials
I tried to retrieve the calendar events of the users having active O365 licenses like below:
I am able to successfully retrieve the calendar events successfully like below:
https://graph.microsoft.com/v1.0/users/{id}/calendar/events
If still the issue persists, check whether the user have calendar or not.
Reference:
Graph API Get Calendar result in Resource not found by Shweta Choudhary

MS Teams - Rich notification are not supported for this resource in 'app + user' context (Graph API)

I'm trying to set up rich notifications for a channel subscription like in the docs below.
New or changed messages in a specific Teams channel: /teams/{id}/channels/{id}/messages
I'm supplying the details to the subscription url like below with ROPC auth flow.
{
"changeType": "created,updated",
"notificationUrl": "https://f554-118-110-222-226.ngrok.io/api/teams/events",
"resource": "teams/TEAM_ID/channels/CHANNEL_ID/messages",
"expirationDateTime": "2021-10-20T02:55:53Z",
"encryptionCertificate": "encryptionCertificate",
"encryptionCertificateId": "encryptionCertificateId",
"includeResourceData": true,
}
I should have all permissions necessary to access this resource since I can create a subscription when includeResourceData is false. However, I'm getting the following error when includeResourceData is true and I supply an encryption cert.
Operation: Create; Exception: [Status Code: BadRequest; Reason: Rich notification are not supported for this resource in 'app + user' context. Please set includeResourceData field to false.]
I think it might be with how my auth and permissions are set up but I'm not entirely sure what this means. Any help is appreciated
Would Suggest you to please try to revalidate and setup all the below prerequisite if might you have missed while setup change notification for team’s channel.
you need to include "includeResourceData" set to "true" and provide certificate information as described here
you need to get your application approved
Other way to subscribe notifications for channel messages dynamically(e.g. powerapp - current user can subscribe to all of his joinedTeams or selected teams and receives push notifications) Because Ms Flows and Logic apps only lets you setup one at a time.
Please follow this MS Document for Set up change notifications that include resource data while creating subscription.
Reference: is team channel messages allowed for change notifications beta? · Issue #3977 · microsoftgraph/microsoft-graph-docs · GitHub
Found the answer to my question in this block of the docs. Thanks to RahulKumarShaw-MT for linking the right version.
https://learn.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-beta&tabs=http#chatmessage
The error below means that since the app was using ROPC auth flow it falls under delegated permissions and is not supported by the API to send encrypted data.
Operation: Create; Exception: [Status Code: BadRequest; Reason: Rich
notification are not supported for this resource in 'app + user'
context. Please set includeResourceData field to false.]
I got around this by having to set up an additional auth token with app permissions set up specifically for this purpose.

SharePoint 2016 send email error, certificate validation errors

I'm facing an issue when trying to send emails from SharePoint, I get one of the error messages below:
An operation failed because the following certificate has validation errors:
Subject Name: CN=mailservername
Issuer Name: CN=mailservername
Thumbprint: 645B2D4B72573478DBD162F39AAE0260B25F6582
Errors: SSL policy errors have been encountered. Error code '0x6'..
An operation failed because the following certificate has validation errors:
Subject Name: CN=mailservername
Issuer Name: CN=mailservername
Thumbprint: 645B2D4B72573478DBD162F39AAE0260B25F6582
Errors: The root of the certificate chain is not a trusted root authority..
I have a single server farm, with SharePoint server 2016
When I configured the outgoing emails with the exchange server as provided by the IT team (mail.organizationname.gov.xx) or the server IP, I get the first error message.
When I configured it with the mail server name as mentioned in the error (either as is, or with domain (FQDM)) I get the second error !
Any help would be highly appreciated
Thank you
I have received a good answer on a question I posted on sharepoint.stackexchange:
https://sharepoint.stackexchange.com/a/257970/40065
From which I learned that the actual problem (In my case) was only on PowerShell "SendEmail" method, and SharePoint itself was working fine with emails
P.S: the answer contains a link to a comprehensive Microsoft Technet blog which covers Configuring TLS encryption between SharePoint on-premise and Exchange

Microsoft Graph 'created' subscription is not working with application token

I have a working application integrated with Microsoft Graph with application token received with a certificate.
I can subscribe to "updated,deleted" events on user contacts and calendars but I can't subscribe to "updated,deleted,created".
Resource used /users/<email>/contacts and /users/<email>/calendars
It gives me the following error on POST /subscriptions :
error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: NotFound; Reason: Not Found]",
"innerError": {
"request-id": "<skip>",
"date": "<skip>"
}
I just checked with a sandbox and it works with a user authenticated (I haven't check fully but at least it timeouts on a server side). Though with application token it's not working.
As per the documentation: 'User and group notifications support updated and deleted changeType.'
Reference:
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/subscription
Drive root item notifications support only the updated changeType. User and group notifications support updated and deleted changeType.
I think I made something wrong in the beginning.
/users/<email>/calendars is a wrong link. To get user events it should be /users/<email>/calendar/events.
And /users/<email>/contacts created is working properly.

Getting token in Office 365 Oauth2 authentication

I am implementing Oauth 2 authentication for Office 365 account in a java based server side application. After reading the documentation, I have done the following things:
I have office 365 subscription.
I have created an app in Azure
Actve directory, that is necessary to authenticate web app using
office 365 account.
I have client ID and secret. I have also
given all permission to the Azure app.
I am requesting authorization code using the Url:
https://login.microsoftonline.com/common/oauth2/authorize?client_id={client_id}&response_type=code&redirect_uri={redirect url}&response_mode=query
As a response of this, I am getting authorization code as expected:
http://localhost:8080?code={authorication code}&session_state=259479e4-84aa-42ea-91e9-9e919cc99587
Now I need to get token along with the user name (user ID from which the user in logged in), as I need the user name for further processing. For this, I am using the method described here:
https://azure.microsoft.com/en-us/documentation/articles/active-directory-protocols-oauth-code/
That is using a POST request like this:
POST /{tenant}/oauth2/token HTTP/1.1
Host: https://login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&client_id=2d4d11a2-f814-46a7-890a-274a72a7309e
&code=AwABAAAAvPM1KaPlrEqdFSBzjqfTGBCmLdgfSTLEMPGYuNHSUYBrqqf_ZT_p5uEAEJJ_nZ3UmphWygRNy2C3jJ239gV_DBnZ2syeg95Ki-374WHUP-i3yIhv5i-7KU2CEoPXwURQp6IVYMw-DjAOzn7C3JCu5wpngXmbZKtJdWmiBzHpcO2aICJPu1KvJrDLDP20chJBXzVYJtkfjviLNNW7l7Y3ydcHDsBRKZc3GuMQanmcghXPyoDg41g8XbwPudVh7uCmUponBQpIhbuffFP_tbV8SNzsPoFz9CLpBCZagJVXeqWoYMPe2dSsPiLO9Alf_YIe5zpi-zY4C3aLw5g9at35eZTfNd0gBRpR5ojkMIcZZ6IgAA
&redirect_uri=https%3A%2F%2Flocalhost%2Fmyapp%2F
&resource=https%3A%2F%2Fservice.contoso.com%2F
&client_secret=p#ssw0rd
Now the problem is that, when ever I send this post request, I always get error with error code some times 400 or 402 etc. I also user POST man in chrome to check the response of the call. It always return error like that:
{
"error": "invalid_grant",
"error_description": "AADSTS65001: The user or administrator has not consented to use the application with ID. Send an interactive authorization request for this user and resource.\r\nTrace ID: b834315e-ccb3-4533-b7c9-4af7b34054b9\r\nCorrelation ID: 784f18da-5479-4b69-b939-0067abfcc460\r\nTimestamp: 2016-08-02 07:28:22Z",
"error_codes": [
65001
],
"timestamp": "2016-08-02 07:28:22Z",
"trace_id": "b834315e-ccb3-4533-b7c9-4af7b34054b9",
"correlation_id": "784f18da-5479-4b69-b939-0067abfcc460"
}
(Note: I have registered all the apps using administrator login)
I have tried a lot to find out whats is going wrong here. I have added multiple apps in Azure Active directory but I am always getting similar response.
I request professionals to help me. . . ! Actually I want to allow user to click on a button in office 365 web add-in and use oauth2 authentication to login to our system. It will be great in somebody suggest me some good tutorial to successfully implement this.
If you were requesting the access token for the Office 365, the resource parameter in the send request should be https%3A%2F%2Foutlook.office.com.
And also you can use the Microsoft Graph as Philip suggested. You can refer here about how to choose the endpoint.
Receiving the error codes "interaction_required" or "invalid_grant" error codes means there is an issue with the "Refresh token" and it advised to:
Discard current refresh token
Request new authorization code

Resources