In my previous post, I showed how to monitor VMC maintenance events with a Slack webhook. You can review the previous post for full details on everything the VMC on AWS Notification Gateway can do. In this post, I will show you how to configure notifications with Office365. Office365 groups have incoming webhooks, meaning you can POST data directly to a URL and it will show up in the group. This is a great way to customize the notifications you receive in your inbox.
I first went to https://outlook.office.com and created a new test group.
Edit the group settings.
Then pick Connectors
Now I add an Incoming Webhook
I name my new group, and I had the option to upload a customized image.
The webhook is created, I copy the URL.
Install the NGW PowerCLI modules if you don’t have them.
Install-Module VMware.VMC.Notification
Install-Module VMware.VimAutomation.VMC
Import-Module VMware.VMC.Notification
Import-Module VMware.VimAutomation.VMC
Connect to your VMC SDDC
$RefreshToken='[your token]'
Connect-VMC -RefreshToken $RefreshToken
Server User
------ ----
vmc.vmware.com pkremer
Connect-VmcNotification -OrgName "VMC-SET-AMER-DEMO" -RefreshToken $RefreshToken
headers Server
------- ------
{Content-Type, csp-auth-token, Accept} https://vmc.vmware.com/vmc/ng/api/orgs/[redacted]
I used the same Notification Events as the previous post. I create the payload, then create a new notification webhook.
$vmcSlackNotificationParams = @{
ClientId = "vmc-sddc-slack-notification";
WebhookURL = "https://onevmw.webhook.office.com/webhookb2/[redacted]";
NotificationEvents = @("VRTvCenterUpgradeCompleted","SddcSSLCertificationReplacement","SDDC-PROVISION","SDDC-DELETE");
}
New-VmcNotificationWebhook @vmcSlackNotificationParams
user_id : [redacted]
user_name : pkremer@vmware.com
created : 5/28/2021 7:09:58 PM
version : 1
id : 215b7d54-[redacted]
updated_by_user_id : [redacted]
updated_by_user_name : pkremer@vmware.com
updated : 5/28/2021 7:09:58 PM
client_id : vmc-sddc-slack-notification
org_id : [redacted]
status : ACTIVE
web_hook_info : @{callback_uri=[redacted]}
Now I use the Test-VmcNotificationWebhook function to send a test event
Test-VmcNotificationWebhook -id 215b7d54-[redacted] -EventID SDDC-PROVISION
Successfully sent test webhook and recieved acknowledgement
I check in Outlook and I received the notification!
Monitoring VMware Cloud on AWS maintenance with Notification Gateway webhooks -
[…] Part II, I show you how to do this with Office365 […]