Forum Discussion
Need Info using Send-MailMessage API
You can do that by running Connect-ExchangeOnline. It will ask for credentials and after successful authentication, it will import the cmdlets into your session. After that, you can continue with the Set-TransportConfig cmdlet. Grtz, Ruud
RGijsbersRademakers , Do you mind letting me know which specific Connect-ExchangeOnline API needs to be used? I used 'Connect-ExchangeOnline -UserPrincipalName mbarooah@microsoft.com -Credential Get-Credential' and provided my credentials but received the error below. Do I need to be a managed user as mentioned below?
The user is not recognized as a managed user, or a federated user.Azure AD was not able to identify the IdP that needs
to process the user U/P: Wrong username
At C:\Program Files
(x86)\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.0.0\netFramework\ExchangeOnlineManagement.psm1:726 char:21
+ throw $_.Exception.InnerException;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : The user is not recognized as a managed user, or a federated user.Azure AD was not able
to identify the IdP that needs to process the user U/P: Wrong username
- RGijsbersRademakersDec 15, 2022Iron Contributor
Hi monishabarooah, to be able to change the transport config setting in Exchange Online, you will need to login with an account that has the Exchange Administrator role within your tenant. Normally these roles are assigned to separate admin accounts and not to the standard user accounts.
When you just run Connect-ExchangeOnline and hit Enter, it will ask your credentials. There's no need to specify the UserPrincipalName by using the -UserPrincipalName switch, or to use the -Credential switch.
But we should take a step back here and get a clear understanding of what you're trying to achieve and how your environment is looking like. Maybe there are other ways to send the email, for example by using a local Exchange Server if your organization has a hybrid exchange environment. Or perhaps you can use a service like Sendgrid to send out your email.
Can you elaborate a bit more about the use case your trying to solve? That would help in getting to best solution.
Br. Ruud