1

I have followed the steps on this page https://adamtheautomator.com/azure-send-email. What I am trying to do is send an email out from a Ps script.

I get the error message below.

VERBOSE: POST https://graph.microsoft.com/v1.0/users/xxxxxxxxx@domain.com/sendMail with -1-byte payload
Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At line:65 char:1
+ Invoke-RestMethod @params -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

What have I done ?

Did some research and found a similar question, How to get mailbox for my new Azure Active Directory Domain?

At the moment I am trying to send the email as myself (using my email address). I do however have a mailbox created for alerts, so I could send as that user, the issue I have here is that with the 404 error it means the endpoint is incorrect.

  "URI"         = "https://graph.microsoft.com/v1.0/users/$fromAddress/sendMail"

I am unsure as to what to use as the sender email address, the link suggests that the user sending out the email alert should have a mailbox. You need an O365 subscription for your AAD, then you can assign the license to the users which you need a mailbox.

We use O365, I have a mailbox, how can i tell if AAD has a o365 subscription ? How can i tell that i am using the correct sender email address, during my research I saw examples using name@domain.com and in some cases name.domain.onmicrosoft.com. I have tried several combinations to no avail, this should not be a guessing game, how can I be sure of using the right details ?

learner
  • 545
  • 2
  • 9
  • 23
  • [Azure AD editions and Microsoft 365 identity management](https://learn.microsoft.com/en-us/microsoft-365/enterprise/azure-integration?view=o365-worldwide#azure-ad-editions-and-microsoft-365-identity-management) and [How to know/find which Azure AD edition do we have?](https://techcommunity.microsoft.com/t5/azure-active-directory-identity/how-to-know-find-which-azure-ad-edition-do-we-have/m-p/296167) – Ecstasy May 16 '22 at 11:35
  • I assigned the Office 365 E1 to my AZ AD profile account, still no luck. Checked AAD cant see anything there about office 365, tried to login to office 365 admin no access, ran a few snippets and it appears its a P1 licence assigned. `SkuPartNumber = STANDARDPACK` – learner May 16 '22 at 13:45

0 Answers0