Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Yoo justinyoo

View GitHub Profile
@justinyoo
justinyoo / 01-auth-login-aad.txt
Created Sep 12, 2021
Accessing MSGraph from Blazor WASM Running on ASWA
View 01-auth-login-aad.txt
https://<azure_static_webapp>.azurestaticapps.net/.auth/login/aad
View 01-default-http-trigger.cs
public static class DefaultHttpTrigger
{
[FunctionName("DefaultHttpTrigger")]
[OpenApiOperation(operationId: "greeting", tags: new[] { "greeting" }, Summary = "Greetings", Description = "This shows a welcome message.", Visibility = OpenApiVisibilityType.Important)]
[OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiParameter("name", Type = typeof(string), In = ParameterLocation.Query, Visibility = OpenApiVisibilityType.Important)]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(Greeting), Summary = "The response", Description = "This returns the response")]
public static async Task<IActionResult> Run(
@justinyoo
justinyoo / 01-on-team-page-requested-1.yaml
Created Aug 20, 2021
Running Hackathon by Yourself with GitHub Actions, Microsoft 365 and Power Platform
View 01-on-team-page-requested-1.yaml
name: On Team Page Requested
on:
workflow_dispatch:
inputs:
teamName:
description: The name of team
required: true
default: Team_HackaLearn
content:
@justinyoo
justinyoo / 00-program.cs
Created Aug 13, 2021
Azure Functions OpenAPI on .NET 5
View 00-program.cs
public static void Main()
{
var host = new HostBuilder()
// 👇👇👇👇👇 Remove this line below 👇👇👇👇👇
.ConfigureFunctionsWorkerDefaults()
// 👆👆👆👆👆 Remove this line above 👆👆👆👆👆
.Build();
host.Run();
}
@justinyoo
justinyoo / 01-create-routine-01.cs
Created May 19, 2021
Tracing End-to-End Data from Power Apps to Azure Cosmos DB
View 01-create-routine-01.cs
public async Task<IActionResult> CreateRoutineAsync(
[HttpTrigger(AuthorizationLevel.Function, HttpVerbs.Post, Route = "routines")] HttpRequest req,
ExecutionContext context,
ILogger log)
{
var request = await req.ToRequestMessageAsync<RoutineRequestMessage>().ConfigureAwait(false);
var @interface = request.Interface;
var correlationId = request.CorrelationId;
var spanId = request.SpanId;
@justinyoo
justinyoo / 01-create-routine.cs
Created May 11, 2021
Developing Power Apps in Fusion Teams
View 01-create-routine.cs
// Decorators for OpenAPI
[OpenApiOperation(operationId: "CreateRoutine", tags: new[] { "publisher", "routine" }, Summary = "Create a new routine", Description = "This creates a new routine", Visibility = OpenApiVisibilityType.Important)]
[OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "x-functions-key", In = OpenApiSecurityLocationType.Header, Description = "API key to execute this endpoint")]
[OpenApiRequestBody(contentType: ContentTypes.ApplicationJson, bodyType: typeof(RoutineRequestMessage), Required = true, Example = typeof(RoutineRequestMessageExample), Description = "The request message payload for a routine")]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: ContentTypes.ApplicationJson, bodyType: typeof(RoutineResponseMessage), Example = typeof(RoutineResponseMessageExample), Summary = "200 response", Description = "This returns the response of 'OK'")]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.InternalServerError, contentType: ContentTypes.Application
View 01-bicep-build.sh
# Bicep CLI
bicep build azuredeploy.bicep
# Azure CLI
az bicep build --file azuredeploy.bicep
@justinyoo
justinyoo / 01-install-azuread.ps1
Last active Jul 6, 2021
Automatic Provisioning Power Platform Hands-on-Labs Environment
View 01-install-azuread.ps1
Install-Module -Name AzureAD `
-Scope AllUsers -Repository PSGallery `
-Force -AllowClobber
@justinyoo
justinyoo / 01-func-init.sh
Last active Mar 9, 2021
Enabling Open API on Azure Functions
View 01-func-init.sh
func init MyFunctionApp --worker-runtime dotnet
View 01-counter.razor
@page "/counter"
<h1>Counter</h1>
<p>Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;