Skip to content

Instantly share code, notes, and snippets.

View pratapprashant's full-sized avatar

Prashant Pratap pratapprashant

View GitHub Profile
@pratapprashant
pratapprashant / AzureFunctionApp.ps1
Created October 15, 2017 23:07
Calling AI APIs from Azure FunctionApp (PowerShell)
# POST method: $req
$requestBody = Get-Content $req -Raw | ConvertFrom-Json
$name = $requestBody.name
$instrumentationKey = "<ai key>"
$aiClient = New-Object "Microsoft.ApplicationInsights.TelemetryClient"
$aiClient.InstrumentationKey = $instrumentationKey
$aiClient.TrackPageView("my pageview")
#$aiClient.TrackEvent("my event")
@pratapprashant
pratapprashant / Program.cs
Created September 23, 2016 05:17
Azure Stream Analytics Code
using Microsoft.ServiceBus.Messaging;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SendingEvents2EventHub
$resourceGroupName = "pscmdletResourceGroup"
$appServicePlanName = "pscmdletServicePlan"
$newWebsiteName = "pscmdletWebsite"
$location = "West US"
$error.clear()
write-host "trying to load azure dlls"
write-host "trying to load azure dlls"
Import-module azure
write-host "trying to log into Azure"
#Select-AzureSubscription -Default "Microsoft Azure Internal Consumption"
#Add-AzureAccount
#Login-AzureRmAccount
write-host "trying to get website details"
# Get-AzureRMResource -ResourceType "microsoft.web/sites" -ResourceGroupName $ResourceGroupName -ResourceName $WebsiteName