Updated to use Functions runtime version 3 (latest)

This commit is contained in:
spelluru 2020-06-08 23:54:07 -04:00 коммит произвёл Serkant Karaca
Родитель 33aa471192
Коммит 4929ad973d
12 изменённых файлов: 597 добавлений и 33 удалений

Просмотреть файл

@ -1,13 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
# Visual Studio Version 16
VisualStudioVersion = 16.0.30128.36
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindTurbineDataGenerator", "WindTurbineDataGenerator\WindTurbineDataGenerator.csproj", "{0C87A54A-AD21-46D5-8B75-4247DA32237E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunctionEGDWDumper", "FunctionEGDWDumper\FunctionEGDWDumper.csproj", "{E29F9E83-073D-4371-929A-A1A045B9596E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DWDumper", "DWDumper\DWDumper.csproj", "{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionEGDWDumper", "FunctionEGDWDumper\FunctionEGDWDumper.csproj", "{27D28A3D-4157-4ED2-A1C4-5525507CCA04}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindTurbineDataGenerator", "WindTurbineDataGenerator\WindTurbineDataGenerator.csproj", "{0C87A54A-AD21-46D5-8B75-4247DA32237E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,23 +15,23 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Release|Any CPU.Build.0 = Release|Any CPU
{E29F9E83-073D-4371-929A-A1A045B9596E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E29F9E83-073D-4371-929A-A1A045B9596E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E29F9E83-073D-4371-929A-A1A045B9596E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E29F9E83-073D-4371-929A-A1A045B9596E}.Release|Any CPU.Build.0 = Release|Any CPU
{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}.Release|Any CPU.Build.0 = Release|Any CPU
{27D28A3D-4157-4ED2-A1C4-5525507CCA04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27D28A3D-4157-4ED2-A1C4-5525507CCA04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27D28A3D-4157-4ED2-A1C4-5525507CCA04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27D28A3D-4157-4ED2-A1C4-5525507CCA04}.Release|Any CPU.Build.0 = Release|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0BDB7260-AF54-438B-B99E-95E7136C1486}
SolutionGuid = {CABDAC3A-BADD-423D-B33B-983C7CBD0F46}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,264 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# Azure Functions localsettings file
local.settings.json
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

Просмотреть файл

@ -5,6 +5,7 @@ using System;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
@ -62,17 +63,18 @@ namespace FunctionEGDWDumper
/// Dumps the data from the Avro blob to the data warehouse (DW).
/// Before running this, ensure that the DW has the required <see cref="TableName"/> table created.
/// </summary>
private static void Dump(Uri fileUri)
private static async void Dump(Uri fileUri)
{
// Get the blob reference
var storageAccount = CloudStorageAccount.Parse(StorageConnectionString);
var blobClient = storageAccount.CreateCloudBlobClient();
var blob = blobClient.GetBlobReferenceFromServer(fileUri);
var blob = await blobClient.GetBlobReferenceFromServerAsync(fileUri);
using (var dataTable = GetWindTurbineMetricsTable())
{
// Parse the Avro File
using (var avroReader = DataFileReader<GenericRecord>.OpenReader(blob.OpenRead()))
Stream blobStream = await blob.OpenReadAsync(null, null, null);
using (var avroReader = DataFileReader<GenericRecord>.OpenReader(blobStream))
{
while (avroReader.HasNext())
{

Просмотреть файл

@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<UserSecretsId>c542a7d9-5d67-443a-b50f-0ea02bd96fcd</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Apache.Avro" Version="1.7.7.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="1.0.0-beta4" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.13" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Apache.Avro" Version="1.9.2" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.2.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
@ -20,4 +20,4 @@
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
</Project>

Просмотреть файл

@ -0,0 +1,222 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "spegridehubgrp",
"location": "eastus",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat('spegridehubgrpDeployment', uniqueString(subscription().subscriptionId))]",
"resourceGroup": "spegridehubgrp",
"apiVersion": "2019-10-01",
"dependsOn": [
"spegridehubgrp"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"id": "/subscriptions/a61d8041-614d-4f85-b928-4b24c8abc76c/resourceGroups/spegridehubgrp/providers/Microsoft.Web/sites/spegridehubfuncapp",
"name": "spegridehubfuncapp",
"type": "Microsoft.Web/sites",
"kind": "functionapp",
"location": "East US",
"properties": {
"name": "spegridehubfuncapp",
"state": "Running",
"hostNames": [
"spegridehubfuncapp.azurewebsites.net"
],
"webSpace": "spegridehubgrp-EastUSwebspace",
"selfLink": "https://waws-prod-blu-119.api.azurewebsites.windows.net:454/subscriptions/a61d8041-614d-4f85-b928-4b24c8abc76c/webspaces/spegridehubgrp-EastUSwebspace/sites/spegridehubfuncapp",
"repositorySiteName": "spegridehubfuncapp",
"owner": null,
"usageState": 0,
"enabled": true,
"adminEnabled": true,
"enabledHostNames": [
"spegridehubfuncapp.azurewebsites.net",
"spegridehubfuncapp.scm.azurewebsites.net"
],
"siteProperties": {
"metadata": null,
"properties": [
{
"name": "LinuxFxVersion",
"value": ""
},
{
"name": "WindowsFxVersion",
"value": null
}
],
"appSettings": null
},
"availabilityState": 0,
"sslCertificates": null,
"csrs": [],
"cers": null,
"siteMode": null,
"hostNameSslStates": [
{
"name": "spegridehubfuncapp.azurewebsites.net",
"sslState": 0,
"ipBasedSslResult": null,
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"toUpdateIpBasedSsl": null,
"ipBasedSslState": 0,
"hostType": 0
},
{
"name": "spegridehubfuncapp.scm.azurewebsites.net",
"sslState": 0,
"ipBasedSslResult": null,
"virtualIP": null,
"thumbprint": null,
"toUpdate": null,
"toUpdateIpBasedSsl": null,
"ipBasedSslState": 0,
"hostType": 1
}
],
"computeMode": null,
"serverFarm": null,
"serverFarmId": "/subscriptions/a61d8041-614d-4f85-b928-4b24c8abc76c/resourceGroups/spegridehubgrp/providers/Microsoft.Web/serverfarms/spegridehubfuncappPlan",
"reserved": false,
"isXenon": false,
"hyperV": false,
"lastModifiedTimeUtc": "2020-06-09T02:15:32.4033333",
"storageRecoveryDefaultState": "Running",
"contentAvailabilityState": 0,
"runtimeAvailabilityState": 0,
"siteConfig": {
"numberOfWorkers": null,
"defaultDocuments": null,
"netFrameworkVersion": null,
"phpVersion": null,
"pythonVersion": null,
"nodeVersion": null,
"powerShellVersion": null,
"linuxFxVersion": null,
"windowsFxVersion": null,
"requestTracingEnabled": null,
"remoteDebuggingEnabled": null,
"remoteDebuggingVersion": null,
"httpLoggingEnabled": null,
"azureMonitorLogCategories": null,
"acrUseManagedIdentityCreds": false,
"acrUserManagedIdentityID": null,
"logsDirectorySizeLimit": null,
"detailedErrorLoggingEnabled": null,
"publishingUsername": null,
"publishingPassword": null,
"appSettings": null,
"metadata": null,
"connectionStrings": null,
"machineKey": null,
"handlerMappings": null,
"documentRoot": null,
"scmType": null,
"use32BitWorkerProcess": null,
"webSocketsEnabled": null,
"alwaysOn": null,
"javaVersion": null,
"javaContainer": null,
"javaContainerVersion": null,
"appCommandLine": null,
"managedPipelineMode": null,
"virtualApplications": null,
"winAuthAdminState": null,
"winAuthTenantState": null,
"customAppPoolIdentityAdminState": null,
"customAppPoolIdentityTenantState": null,
"runtimeADUser": null,
"runtimeADUserPassword": null,
"loadBalancing": null,
"routingRules": null,
"experiments": null,
"limits": null,
"autoHealEnabled": null,
"autoHealRules": null,
"tracingOptions": null,
"vnetName": null,
"cors": null,
"push": null,
"apiDefinition": null,
"apiManagementConfig": null,
"autoSwapSlotName": null,
"localMySqlEnabled": null,
"managedServiceIdentityId": null,
"xManagedServiceIdentityId": null,
"ipSecurityRestrictions": null,
"scmIpSecurityRestrictions": null,
"scmIpSecurityRestrictionsUseMain": null,
"http20Enabled": null,
"minTlsVersion": null,
"ftpsState": null,
"preWarmedInstanceCount": null,
"healthCheckPath": null,
"fileChangeAuditEnabled": null,
"functionsRuntimeScaleMonitoringEnabled": null,
"websiteTimeZone": null,
"minimumElasticInstanceCount": 0
},
"deploymentId": "spegridehubfuncapp",
"trafficManagerHostNames": null,
"sku": "Dynamic",
"scmSiteAlsoStopped": false,
"targetSwapSlot": null,
"hostingEnvironment": null,
"hostingEnvironmentProfile": null,
"clientAffinityEnabled": false,
"clientCertEnabled": false,
"clientCertMode": 0,
"clientCertExclusionPaths": null,
"hostNamesDisabled": false,
"domainVerificationIdentifiers": null,
"customDomainVerificationId": "A92BAA23A498CC9938061E0B8402F7BED64FCEB003CF0C501E2595F2D6423CCA",
"kind": "functionapp",
"inboundIpAddress": "40.121.35.221",
"possibleInboundIpAddresses": "40.121.35.221",
"ftpUsername": "spegridehubfuncapp\\$spegridehubfuncapp",
"ftpsHostName": "ftps://waws-prod-blu-119.ftp.azurewebsites.windows.net/site/wwwroot",
"outboundIpAddresses": "40.121.35.221,40.114.109.158,104.211.29.193,13.68.131.60,40.87.86.14",
"possibleOutboundIpAddresses": "40.121.35.221,40.114.109.158,104.211.29.193,13.68.131.60,40.87.86.14,13.68.130.103,40.87.82.124,13.68.137.247",
"containerSize": 1536,
"dailyMemoryTimeQuota": 0,
"suspendedTill": null,
"siteDisabledReason": 0,
"functionExecutionUnitsCache": null,
"maxNumberOfWorkers": null,
"homeStamp": "waws-prod-blu-119",
"cloningInfo": null,
"hostingEnvironmentId": null,
"tags": null,
"resourceGroup": "spegridehubgrp",
"defaultHostName": "spegridehubfuncapp.azurewebsites.net",
"slotSwapStatus": null,
"httpsOnly": false,
"redundancyMode": 0,
"inProgressOperationId": null,
"geoDistributions": null,
"privateEndpointConnections": [],
"buildVersion": null,
"targetBuildVersion": null
},
"apiVersion": "2015-05-01"
}
]
}
}
}
]
}

Просмотреть файл

@ -0,0 +1,41 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "spegridehubgrp",
"location": "eastus",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat('spegridehubgrpDeployment', uniqueString(subscription().subscriptionId))]",
"resourceGroup": "spegridehubgrp",
"apiVersion": "2019-10-01",
"dependsOn": [
"spegridehubgrp"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "Storage",
"name": "spegridehubstorage",
"type": "Microsoft.Storage/storageAccounts",
"location": "eastus",
"apiVersion": "2017-10-01"
}
]
}
}
}
]
}

Просмотреть файл

@ -0,0 +1,8 @@
{
"dependencies": {
"storage1": {
"type": "storage",
"connectionId": "AzureWebJobsStorage"
}
}
}

Просмотреть файл

@ -0,0 +1,8 @@
{
"dependencies": {
"storage1": {
"type": "storage.emulator",
"connectionId": "AzureWebJobsStorage"
}
}
}

Просмотреть файл

@ -0,0 +1,10 @@
{
"dependencies": {
"storage1": {
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroup')]/providers/Microsoft.Storage/storageAccounts/spegridehubstorage",
"type": "storage.azure",
"connectionId": "AzureWebJobsStorage",
"secretStore": "AzureAppSettings"
}
}
}

Просмотреть файл

@ -1,2 +1,11 @@
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingExcludedTypes": "Request",
"samplingSettings": {
"isEnabled": true
}
}
}
}

Просмотреть файл

@ -1,7 +1,7 @@
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"AzureWebJobsDashboard": ""
}
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}

Просмотреть файл

@ -13,9 +13,9 @@ namespace WindTurbineDataGenerator
internal class Program
{
private const string EventHubConnectionString =
"[provide the EH connection string]";
"<EVENT HUBS NAMESPACE CONNECTION STRING>";
private const string EventHubName = "[provide the EH name]";
private const string EventHubName = "<EVENT HUB NAME>";
private static int Main(string[] args)
{