Skip to content

Instantly share code, notes, and snippets.

View justinyoo's full-sized avatar

Justin Yoo justinyoo

View GitHub Profile
@justinyoo
justinyoo / _hal-swagger-sample.txt
Last active October 28, 2015 03:41
This is a sample code for HAL and Swagger integration
This is a sample code for HAL and Swagger integration
* http://devkimchi.com/2041/creating-service-contract-with-autorest-swagger-and-hal
* http://blog.kloud.com.au/2015/10/26/creating-service-contract-with-autorest-swagger-and-hal
@justinyoo
justinyoo / logic-app-endpoint.txt
Last active December 7, 2017 02:59
Securing SAS Token from Azure Logic Apps
https://prod-23.centralus.logic.azure.com:443/workflows/0c9def69700c4b2995e2e587123306f7/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=ORQeXlFZxBeF7xmF9pO73sgYl_-w0v6V9uugi8bhHeA
@justinyoo
justinyoo / ServiceClient.cs
Created December 10, 2017 12:47
SOAP over Azure API Management, Logic Apps and Functions
public partial class Service1Client : ClientBase<IService1>, IService1
{
public Service1Client()
{
}
// This constructor is of no use for Azure Functions
// because it doesn't use Web.config or App.config
public Service1Client(string endpointConfigurationName)
: base(endpointConfigurationName)
@justinyoo
justinyoo / WcfCallingHttpTrigger.cs
Created December 10, 2017 12:47
SOAP over Azure API Management, Logic Apps and Functions
public static class WcfCallingHttpTrigger
{
[FunctionName("WcfCallingHttpTrigger")]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "data/{value}")] HttpRequestMessage req,
int value,
TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
@justinyoo
justinyoo / App.config
Last active December 10, 2017 12:47
SOAP over Azure API Management, Logic Apps and Functions
<configuration>
...
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint name="BasicHttpBinding_IService1"
@justinyoo
justinyoo / gist-example.cs
Created December 11, 2017 05:26
gist example
public static class GistExample
{
public static string Lorem => "Ipsum";
}
@justinyoo
justinyoo / Get-AuthToken.ps1
Last active December 15, 2017 04:04
Dynamic Access to Azure Functions Host Keys without KUDU
# NOTE: This is NOT a real tenant Id, subscription Id, client Id nor client secret. Use yours.
$tenantId = "32a489b1-612c-4d44-b4dd-714376ac7479"
$subscriptionId = "4ba9940b-0057-4184-9965-eb686c3027bc"
$clientId = "310c7137-af66-4bb1-ac76-c4cb4fcbe4e1"
$clientSecret = "QMvihWUWlRuPs3nNjxxzR/rULyKOAibRBkWDsbokzqw="
$authUri = "https://login.microsoftonline.com/$tenantId/oauth2/token?api-version=1.0"
$resourceUri = "https://management.core.windows.net/"
$authRequestBody = @{}
@justinyoo
justinyoo / Get-AdminToken.ps1
Created December 15, 2017 04:04
Dynamic Access to Azure Functions Host Keys without KUDU
# NOTE: This is NOT a real resource group name nor function app name. Use yours.
$resourceGroupName = "my-resource-group"
$functionAppName = "my-azure-function"
$accessTokenHeader = @{ "Authorization" = "Bearer " + $auth.access_token }
$azureRmBaseUri = "https://management.azure.com"
$azureRmApiVersion = "2016-08-01"
$azureRmResourceType = "Microsoft.Web/sites"
$azureRmResourceId = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/$azureRmResourceType/$functionAppName"
@justinyoo
justinyoo / List-Functions.ps1
Created December 15, 2017 04:04
Dynamic Access to Azure Functions Host Keys without KUDU
$azureRmListFunctionsEndpoint = "/functions"
$listFunctionsUri = $azureRmBaseUri + $azureRmResourceId + $azureRmListFunctionsEndpoint + "?api-version=" + $azureRmApiVersion
$listFunctions = Invoke-RestMethod -Method Get -Uri $listFunctionsUri -Headers $accessTokenHeader
@justinyoo
justinyoo / Get-FunctionKeys.ps1
Created December 15, 2017 04:04
Dynamic Access to Azure Functions Host Keys without KUDU
$functionAppBaseUri = "https://$functionAppName.azurewebsites.net/admin"
$functionName = "test1"
$functionKeysEndpoint = "/functions/$functionName/keys"
$functionKeysUri = $functionAppBaseUri + $functionKeysEndpoint
$adminTokenHeader = @{ "Authorization" = "Bearer " + $adminBearerToken }
$functionKeys = Invoke-RestMethod -Method Get -Uri $functionKeysUri -Headers $adminTokenHeader