Build with an Azure free account. Get USD200 credit for 30 days and 12 months of free services.

Start free today

Serverless automation using PowerShell in Azure Functions

Play Serverless automation using PowerShell in Azure Functions

The Discussion

  • User profile image
    Elliot Munro

    Any chance we could get a copy of the script which posts that card to a Teams channel?

  • User profile image
    Below is the function to send a teams message. The $env:TeamsWebhook is manually generated for an incoming webhook to the Teams channel. You can get it by right clicking -> connectors -> Incoming Webhook from the Teams channel.

    param($Request, $TriggerMetadata)

    # Log body of request
    ConvertTo-Json $Request.Body | Write-Verbose

    # Get Teams channel url from application setting
    $channelURL = $env:TeamsWebhook

    if (!([string]::IsNullOrEmpty($ChannelURL)))
    $TargetURL = $

    $Body = ConvertTo-Json -Depth 4 @{
    title = "Azure Alert has fired"
    text = "Azure Alert has fired"
    sections = @(
    activityTitle = "Azure notification has fired"
    activitySubtitle = "Alert on function app " + $
    activityText = "This is the detail of the alert..."
    activityImage = "https://www.contoso.image.png"
    potentialAction = @(@{
    '@context' = ''
    '@type' = 'ViewAction'
    name = 'Click here to manage Function'
    target = @($TargetURL)

    # call Teams webhook
    Invoke-RestMethod -Method "Post" -Uri $ChannelURL -Body $Body | Write-Verbose
  • User profile image
    Bo Allan

    Do you need to have your Azure Subscription whitelisted for this preview?

  • User profile image

    Is this pitched to ultimately replace Azure Automation in time?

  • User profile image
    Very cool!

Add Your 2 Cents