Skip to content

Instantly share code, notes, and snippets.

View JarroVGIT's full-sized avatar

Jarro van Ginkel JarroVGIT

View GitHub Profile
@concat('{
"','@','type": "MessageCard",
"','@','context": "https://schema.org/extensions",
"summary": "Issue 176715375",
"themeColor": "eb3434",
"title": "Azure DataFactory notification alert!",
"sections": [
{
"activityTitle": "Pipeline failed",
"activitySubtitle": "UTC: ', utcnow() ,'",
@JarroVGIT
JarroVGIT / webhookpayload.json
Last active June 21, 2020 19:27
This is an example payload to be send to an MS Teams webhook URL.
{
"@type": "MessageCard",
"@context": "https://schema.org/extensions",
"summary": "ADF Alert",
"themeColor": "eb3434",
"title": "Azure DataFactory notification alert!",
"sections": [
{
"activityTitle": "Pipeline failed",
"activitySubtitle": "UTC: $timestamp_of_failure$",
@JarroVGIT
JarroVGIT / manifest.json
Created May 16, 2020 13:47
AppRoles definition of our Backend Function Application registration
"appRoles": [
{
"allowedMemberTypes": [
"Application"
],
"displayName": "Allow Frontend Function access to Backend Function",
"id": "e8771cad-cfde-4f6b-b6f4-e246f9b468d2",
"isEnabled": true,
"description": "Allow Managed Identity of Frontend Function to authenticate to Backend Function",
"value": "Things.Read.All"
@JarroVGIT
JarroVGIT / __init__.py
Last active May 16, 2020 13:43
FrontendFunction Protected__init__.py
import logging
import azure.functions as func
import requests
import os
def get_bearer_token(resource_uri):
identity_endpoint = os.environ["IDENTITY_ENDPOINT"]
identity_header = os.environ["IDENTITY_HEADER"]
token_auth_uri = f"{identity_endpoint}?resource={resource_uri}&api-version=2019-08-01"
head_msi = {'X-IDENTITY-HEADER':identity_header}
@JarroVGIT
JarroVGIT / __init__.py
Last active May 16, 2020 13:31
FrontendFunction Unprotected __init__.py
import logging
import azure.functions as func
import requests
def main(req: func.HttpRequest) -> func.HttpResponse:
#Replace the URL with the URL from your Backend Function.
response = requests.get('https://azureblogging-backend.azurewebsites.net/api/SecretAPI').text
return func.HttpResponse(
@JarroVGIT
JarroVGIT / __init__.py
Created May 16, 2020 12:30
BackendFunction __init__.py
import logging
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
return func.HttpResponse(
"\nThis message is from our Secret API in the Backend Function.",
status_code=200
)