-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from MicrosoftLearning/functions-update
Prep for New Azure Functions Labs
- Loading branch information
Showing
19 changed files
with
1,911 additions
and
1,399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Azure.WebJobs; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.Extensions.Logging; | ||
|
||
public static class Echo | ||
{ | ||
[FunctionName("Echo")] | ||
public static IActionResult Run( | ||
[HttpTrigger("POST")] HttpRequest request, | ||
ILogger logger) | ||
{ | ||
logger.LogInformation("Received a request"); | ||
return new OkObjectResult(request.Body); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Azure.WebJobs; | ||
|
||
public static class GetSettingInfo | ||
{ | ||
[FunctionName("GetSettingInfo")] | ||
public static IActionResult Run( | ||
[HttpTrigger("GET")] HttpRequest request, | ||
[Blob("content/settings.json")] string json) | ||
=> new OkObjectResult(json); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using Microsoft.Azure.WebJobs; | ||
using Microsoft.Azure.WebJobs.Host; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace func | ||
{ | ||
public static class Recurring | ||
{ | ||
[FunctionName("Recurring")] | ||
public static void Run([TimerTrigger("*/30 * * * * *")]TimerInfo myTimer, ILogger log) | ||
{ | ||
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<AzureFunctionsVersion>v3</AzureFunctionsVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.10" /> | ||
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Update="host.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="local.settings.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
<CopyToPublishDirectory>Never</CopyToPublishDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "2.0", | ||
"logging": { | ||
"applicationInsights": { | ||
"samplingExcludedTypes": "Request", | ||
"samplingSettings": { | ||
"isEnabled": true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"IsEncrypted": false, | ||
"Values": { | ||
"AzureWebJobsStorage": "<storage-connection-string>", | ||
"FUNCTIONS_WORKER_RUNTIME": "dotnet" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Azure.Storage.Blobs; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Azure.WebJobs; | ||
using Microsoft.AspNetCore.Http; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
public static class FileParser | ||
{ | ||
[FunctionName("FileParser")] | ||
public static async Task<IActionResult> Run( | ||
[HttpTrigger("GET")] HttpRequest request) | ||
{ | ||
string connectionString = Environment.GetEnvironmentVariable("StorageConnectionString"); | ||
BlobClient blob = new BlobClient(connectionString, "drop", "records.json"); | ||
var response = await blob.DownloadAsync(); | ||
return new FileStreamResult(response?.Value?.Content, response?.Value?.ContentType); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<AzureFunctionsVersion>v3</AzureFunctionsVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Azure.Storage.Blobs" Version="12.6.0" /> | ||
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Update="host.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="local.settings.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
<CopyToPublishDirectory>Never</CopyToPublishDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "2.0", | ||
"logging": { | ||
"applicationInsights": { | ||
"samplingExcludedTypes": "Request", | ||
"samplingSettings": { | ||
"isEnabled": true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"IsEncrypted": false, | ||
"Values": { | ||
"AzureWebJobsStorage": "UseDevelopmentStorage=true", | ||
"FUNCTIONS_WORKER_RUNTIME": "dotnet", | ||
"StorageConnectionString": "[TEST VALUE]" | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.