Use Logic Apps To Push to Discord Webhooks
See also CanaryTokens to Sentinel
This is a very helpful tool for formatting the JSON
But here is the basic Example - we need the HTTP webhook Connector and this json:
You can use generic HTTP also for single fire use-case
{
"content": "YOUR TEXT",
"embeds": [
{
"title": "<YOUR TEXT>",
"description": "YOUR TEXT",
"color": 5814783
}
],
"attachments": []
}
Colour is optional
Store Webhooks in Key Vault (Secrets - Get) and use secure Input in logic app to hide the keys between runs
If you know what key you need to pull you don't need to assign Secrets - List. This is up to you for convienence.
When creating the secret use tags to identify discord and usage
You can leverage a Managed Identity (system or user assigned is up to you - pros and cons. If you are building at scale then I'd go User Assigned) and grant azure access policy to the key vault
| Assign Managed Identity | Key Vault Access Policy |
|---|---|
My preference remains Access Policy over Azure RBAC I need to more clear
Creating the connection from Logic app by selecting get Secret and switching the drop down menu to Managed Identity
Because I don't allow Secrets List I need to use Custom Value to add in the secret name - If you added secrets list you can just select from dropdown menu:
| Listing is Forbidden | Use Custom Name |
|---|---|
Make sure to lock input/output from Settings > Security
As I put the entire discord webhook URL in the keyvault this is now what my webhook looks like:
Otherwise a playbook operator role Azure IAM will be able to see the secrets as they are run. Niche but easy to secure
Because the logic app may not get a response from Discord you may want to do a manual terminate so runs do not appear failed.
Need to push to multiple locations? use parallel branches!
As logic app consumption does not support private endpoints you can set the Connector outbound IPs of the logic app as an allowed IP on the key vault, this isn't a true security control but better than nothing.
Bear in mind you will need to add your own IP everytime you want to make a change to the keyvault, remember to clear this down after.
If you are using HTTP trigger and invoking from another logic app this is also a good idea:
HTTP Triggers are great for modularity and reuse as you can define a custom JSON
See Damien Bird - Create variables in your Power Automate Flow or Canvas Power App