- Subject
- Microsoft 365 & SharePoint
- Filed
- Source
- Koskila
- Loans
- 328
Azure Logic Apps Can Turn Dynamic HTTPS Links into mailto URLs
A dynamic-only HTML href can be saved with a mailto prefix. Keep https: literal and append the URL remainder with a Compose action.

When an Azure Logic Apps workflow saves an HTML link whose address comes entirely from dynamic content, it can change the link into a mailto: URL. In a workflow that posts Azure Monitor alerts to Microsoft Teams, that leaves users with a broken link to the alert investigation page. The workaround is to put https: directly in the HTML and append the rest of Azure Monitor’s URL at runtime.
Where the link gets changed
The workflow in this example receives an Azure Monitor alert in the Common Alert Schema, parses the payload, and sends a notification to a Teams channel. The alert data includes an investigationLink value, which points to the relevant investigation page in the Azure Portal. It typically begins with a URL like this:
https://portal.azure.com/#view/Microsoft_Azure_Monitoring_Alerts/Investigate.ReactView/alertId/...Using that value in an HTML anchor seems straightforward:
<a href="@{body('Parse_JSON')?['data']?['essentials']?['investigationLink']}">
🔎 Open alert in Azure Portal
</a>But after the Logic Apps action is saved, the rendered link may start with mailto:https:// instead of https://. The problem begins in the Logic Apps editor when it saves the action; Teams is not the component that adds the prefix.

Why a dynamic href causes trouble
When the entire value of an anchor’s href is an expression, the editor cannot see a literal protocol such as https: while saving the action. It attempts to fill in what it treats as a missing protocol, and in this case inserts mailto:. The expression can still resolve to a valid HTTPS address at runtime, but the saved HTML has already been altered.
That makes the key to the workaround a small change in how the address is assembled. The editor needs to see https: as a fixed part of the href, while the changing portion of the address remains dynamic.

Keep the protocol literal
First, make sure the Parse JSON schema includes the investigationLink property as a string:
"investigationLink": {
"type": "string"
}Then add a Compose action to remove https: from the URL supplied by the alert:
@replace(
body('Parse_JSON')?['data']?['essentials']?['investigationLink'],
'https:',
''
)For example, the original value begins like this:
https://portal.azure.com/#view/...After Compose removes the protocol, the output begins with two slashes:
//portal.azure.com/#view/...Use that output in the anchor while writing the protocol directly into the HTML:
<a href="https:@{outputs('Compose')}">
🔎 Open alert in Azure Portal
</a>When the action is saved, Logic Apps can see the literal https: in the href. At runtime, the Compose output supplies the rest of the address. The two pieces join to form the original HTTPS URL: https: followed by //portal.azure.com/#view/....
The expression is slightly awkward because it removes part of a valid URL only to put that part back in the HTML. In this case, that split is useful: it leaves the protocol visible to the editor while keeping the alert-specific address dynamic.
Keep Azure Monitor’s investigation link
One alternative is to build a Portal URL from an alert ID. That can work, but it means assembling a route yourself when the alert payload already provides investigationLink. In this example, that property points to the Microsoft_Azure_Monitoring_Alerts/Investigate.ReactView route.
Using the supplied link avoids adding a separate dependency on the Portal’s route structure. The Compose action changes how the value is presented to the HTML editor; it does not replace the URL with a manually constructed destination. That distinction matters when the alert link contains route details beyond a simple alert ID.
What to check in your workflow
If a link in a Teams notification has become mailto:https://..., inspect the HTML in the Logic Apps action and check whether the href begins entirely with an expression. If it does, the editor may be adding a protocol because it cannot see one in the literal HTML.
For the pattern described here, the steps are to include investigationLink in the Parse JSON schema, remove https: from its value in a Compose action, and set the anchor to href="https:@{outputs('Compose')}". This keeps the Azure Monitor URL in use while giving the editor a static protocol to preserve when it saves the action. After making the change, check the saved message link to confirm it opens the intended Portal investigation page.