Skip to content

Instantly share code, notes, and snippets.

function Download-FileFromWebApp($resourceGroupName, $webAppName, $slotName = "", $kuduPath, $localPath){
$kuduApiAuthorisationToken = Get-KuduApiAuthorisationHeaderValue $resourceGroupName $webAppName $slotName
if ($slotName -eq ""){
$kuduApiUrl = "https://$webAppName.scm.azurewebsites.net/api/vfs/site/wwwroot/$kuduPath"
}
else{
$kuduApiUrl = "https://$webAppName`-$slotName.scm.azurewebsites.net/api/vfs/site/wwwroot/$kuduPath"
}
$virtualPath = $kuduApiUrl.Replace(".scm.azurewebsites.", ".azurewebsites.").Replace("/api/vfs/site/wwwroot", "")
{
"id": "9ac0d31ac1234567890d685e57164f08",
"functionTimeout": "00:05:00",
"http": {
"routePrefix": "api"
},
"watchDirectories": [ "Shared" ],
"tracing": {
"consoleLevel": "info",
"fileLoggingMode": "debugOnly"
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=pacopollingconsumerstrg;AccountKey=[key];EndpointSuffix=core.windows.net",
"AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=pacopollingconsumerstrg;AccountKey=[key];EndpointSuffix=core.windows.net",
"PollingWatermarkStorage": "DefaultEndpointsProtocol=https;AccountName=pacopollingconsumerstrg;AccountKey=[key];EndpointSuffix=core.windows.net"
}
}
{
"disabled": false,
"scriptFile": "..\\bin\\PacodelaCruz.PollingConsumer.FunctionApp.dll",
"entryPoint": "PacodelaCruz.PollingConsumer.FunctionApp.GetPollingWatermark.Run",
"bindings": [
{
"name": "req",
"type": "httpTrigger",
"direction": "in",
"methods": [ "get" ],
{
"disabled": false,
"scriptFile": "..\\bin\\PacodelaCruz.PollingConsumer.FunctionApp.dll",
"entryPoint": "PacodelaCruz.PollingConsumer.FunctionApp.UpdatePollingWatermark.Run",
"bindings": [
{
"name": "req",
"type": "httpTrigger",
"direction": "in",
"methods": [ "patch" ],
using System;
using Microsoft.WindowsAzure.Storage.Table;
namespace PacodelaCruz.PollingConsumer.FunctionApp
{
/// <summary>
/// Class to handle the entities on the Azure Table Storage called ‘PollingWatermark'.
/// If you want to learn more about using Azure Storage Tables with C# have a look at this documentation
/// https://docs.microsoft.com/en-us/azure/storage/storage-dotnet-how-to-use-tables
/// </summary>
using System;
namespace PacodelaCruz.PollingConsumer.FunctionApp
{
/// <summary>
/// This class will help us to wrap the PollingWatermarkEntity and make it more user friendly. By using the constructor, we are naming the PartitionKey as SourceSystem, and the RowKey as Entity. Additionally, we are returning another property called NextWatermark that is to be used as the upper bound when querying the source system and when updating the Polling Watermark after we have successfully polled the source system
/// </summary>
public class PollingWatermark
{
public string SourceSystem { get; set; }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Azure;
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"properties": {
"state": "Disabled",
"definition": {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Azure;