Skip to content

Instantly share code, notes, and snippets.


Justin Yoo justinyoo

View GitHub Profile
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 / 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
# Bicep CLI
bicep build azuredeploy.bicep
# Azure CLI
az bicep build --file azuredeploy.bicep
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 /
Last active Mar 9, 2021
Enabling Open API on Azure Functions
func init MyFunctionApp --worker-runtime dotnet
View 01-counter.razor
@page "/counter"
<p>Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
justinyoo /
Created Feb 21, 2021
Event-Driven KeyVault Secrets Rotation Management
func new --name DisableSecretHttpTrigger --template HttpTrigger --language C#
justinyoo / 01-keyvault-reference.txt
Last active Feb 16, 2021
KeyVault Secrets Rotation Management
View 01-keyvault-reference.txt
justinyoo / 01-callback-1.cs
Last active Jan 20, 2021
WebSub to EventGrid via CloudEvents and Beyond
View 01-callback-1.cs
public async Task<IActionResult> CallbackAsync(
[HttpTrigger(AuthorizationLevel.Function, "GET", "POST", Route = "callback")] HttpRequest req,
ILogger log)
if (HttpMethods.IsGet(req.Method))
string challenge = req.Query["hub.challenge"];
var result = new ObjectResult(challenge) { StatusCode = 200 };
justinyoo / 01-scraping-article-id.cs
Last active Jan 18, 2021
Dev.To Article Publish Scheduler
View 01-scraping-article-id.cs
var pattern = "<div.+data-article-id=\"(\\d+)\"\\s*id=\"article-body\">";
var regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
var url = "<username>/xxxx-****-temp-slug-xxxx?preview=xxxx";
var http = new HttpClient();
var html = await http.GetStringAsync(url);
var match = regex.Match(html);
var articleId = Convert.ToInt32(match.Groups[1].Value);