Skip to content

Instantly share code, notes, and snippets.

View codemillmatt's full-sized avatar

Matt Soucoup codemillmatt

View GitHub Profile
@codemillmatt
codemillmatt / README.md
Created March 9, 2022 22:20
Using a different storage account

This explains how to use a different storage account (other than the one Azure Functions does) for consuming events in module 1 of Microsoft Azure Developer: Develop Event Based Solutions course.

  1. Create a new app settings key and for its value have the connection string value for the storage account that contains the images and grayscale containers.
    • For this example, we'll call that key EventImageStorage
  2. In the Grayscale.cs file, update the function's Blob declaration attribute to read:
    [Blob("{data.url}", FileAccess.Read, Connection = "EventImageStorage")] Stream inputBlobStream,
  3. Then further down in the body of the function, when you new up the BlobServiceClient, change that to:
@codemillmatt
codemillmatt / LetsGetFunky.cs
Created May 27, 2021 19:11
Funky iPad Function
[FunctionName("LetsGetFunky")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
string[] thingsICanDo = new string[] {
"Write .NET apps on an IPAD!!",
"Write Azure Functions on an IPAD!!",
"Write blogs on an IPAD!!!"
};
@codemillmatt
codemillmatt / appsettings.json
Created August 10, 2020 21:13
Weather app settings
"WeatherAPI": {
"WeatherScope": "api://eb815525-b001-4d12-a00a-116afdc3bf63/access_as_user",
"ApiUrl": "https://localhost:5003/WeatherForecast"
}
@codemillmatt
codemillmatt / ForecastService.cs
Created August 10, 2020 21:10
Using microsoft.identity.web to call a web api
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Identity.Web;
using System.Collections.Generic;
namespace TodoListApp
{
@codemillmatt
codemillmatt / Startup.cs
Created August 10, 2020 21:05
Web App startup that calls web api
services.AddMicrosoftWebAppAuthentication(Configuration, "AzureAd")
.AddMicrosoftWebAppCallsWebApi(Configuration, "AzureAd")
.AddInMemoryTokenCaches();
@codemillmatt
codemillmatt / appsettings.json
Created August 7, 2020 16:50
Web API Settings Default
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "qualified.domain.name",
"TenantId": "22222222-2222-2222-2222-222222222222",
"ClientId": "11111111-1111-1111-11111111111111111",
"CallbackPath": "/signin-oidc"
}
@codemillmatt
codemillmatt / appsettings.json
Created August 6, 2020 16:35
Microsoft.Identity.Web App Settings
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "qualified.domain.name",
"TenantId": "22222222-2222-2222-2222-222222222222",
"ClientId": "11111111-1111-1111-11111111111111111",
"CallbackPath": "/signin-oidc"
}
@codemillmatt
codemillmatt / StartTranscription.cs
Last active April 24, 2020 22:05
How to start up the speech recognizer
using Microsoft.CognitiveServices.Speech; // this is the namespace of the speech to text stuff
SpeechRecognizer recognizer; // this is a class level variable
public async Task StartTranscription()
{
if (recognizer == null)
{
var config = SpeechConfig.FromSubscription("<PUT YOUR KEY HERE>", "westus");
@codemillmatt
codemillmatt / mic.cs
Created April 24, 2020 22:01
Prompt for microphone permissions
public async Task<PermissionStatus> CheckAndRequestMicrophonePermission()
{
var status = await Permissions.CheckStatusAsync<Permissions.Microphone>();
if (status != PermissionStatus.Granted)
{
status = await Permissions.RequestAsync<Permissions.Microphone>();
}
return status;
@codemillmatt
codemillmatt / create.sh
Created April 24, 2020 21:41
Creating an Azure Cognitive Services Speech Service
RESOURCE_GROUP_NAME = "PUT THE NAME OF YOUR RESOURCE GROUP HERE CALL IT WHATEVS"
SPEECH_SERVICE_NAME = "PUT THE NAME OF YOUR SPEECH SERVICE HERE THE NAME IS YOUR CHOICE"
az cognitiveservices account create -n $SPEECH_SERVICE_NAME -g $RESOURCE_GROUP_NAME --kind SpeechServices --sku F0 -l westus
az cognitiveservices account keys list -n $SPEECH_SERVICE_NAME -g $RESOURCE_GROUP_NAME