Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Yoo justinyoo

View GitHub Profile
@justinyoo
justinyoo / 01-install-azuread.ps1
Last active Apr 8, 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;
@justinyoo
justinyoo / 01-func-new-http-trigger.sh
Created Feb 21, 2021
Event-Driven KeyVault Secrets Rotation Management
View 01-func-new-http-trigger.sh
func new --name DisableSecretHttpTrigger --template HttpTrigger --language C#
@justinyoo
justinyoo / 01-keyvault-reference.txt
Last active Feb 16, 2021
KeyVault Secrets Rotation Management
View 01-keyvault-reference.txt
@Microsoft.KeyVault(SecretUri=https://<keyvault_name>.vault.azure.net/secrets/<secret_name>)
@justinyoo
justinyoo / 01-callback-1.cs
Last active Jan 20, 2021
WebSub to EventGrid via CloudEvents and Beyond
View 01-callback-1.cs
[FunctionName("CallbackAsync")]
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
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 = "https://dev.to/<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);
@justinyoo
justinyoo / 01-dotnet-add-package.sh
Last active Jan 10, 2021
Dealing CloudEvents with Azure Functions for Azure EventGrid
View 01-dotnet-add-package.sh
dotnet add package Azure.Messaging.EventGrid --version 4.0.0-beta.4
@justinyoo
justinyoo / 01-az-logic-workflow-show.sh
Last active Jan 7, 2021
Provisioning EventGrid Subscription and LogicApp Handler Using Azure CLI
View 01-az-logic-workflow-show.sh
logicAppResourceId=$(az logic workflow show \
-g <resource_group_name> \
-n <logic_app_name> \
--query "id" -o tsv)
@justinyoo
justinyoo / 01-v1-legacy.cs
Last active Mar 15, 2021
Open API Extension to Support Azure Functions v1
View 01-v1-legacy.cs
namespace MyV1LegacyFunctionApp
{
public static class LoremIpsumHttpTrigger
{
[FunctionName("LoremIpsumHttpTrigger")]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "GET", Route = "lorem/ipsum")] HttpRequestMessage req,
ILogger log)
{
var content = new MyReturnObject();