Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Yoo justinyoo

View GitHub Profile
@justinyoo
justinyoo / _hal-swagger-sample.txt
Last active Oct 28, 2015
This is a sample code for HAL and Swagger integration
View _hal-swagger-sample.txt
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 Dec 7, 2017
Securing SAS Token from Azure Logic Apps
View logic-app-endpoint.txt
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 Dec 10, 2017
SOAP over Azure API Management, Logic Apps and Functions
View ServiceClient.cs
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 Dec 10, 2017
SOAP over Azure API Management, Logic Apps and Functions
View WcfCallingHttpTrigger.cs
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 Dec 10, 2017
SOAP over Azure API Management, Logic Apps and Functions
View App.config
<configuration>
...
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint name="BasicHttpBinding_IService1"
View gist-example.cs
public static class GistExample
{
public static string Lorem => "Ipsum";
}
@justinyoo
justinyoo / Get-AuthToken.ps1
Last active Dec 15, 2017
Dynamic Access to Azure Functions Host Keys without KUDU
View Get-AuthToken.ps1
# 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 Dec 15, 2017
Dynamic Access to Azure Functions Host Keys without KUDU
View Get-AdminToken.ps1
# 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 Dec 15, 2017
Dynamic Access to Azure Functions Host Keys without KUDU
View List-Functions.ps1
$azureRmListFunctionsEndpoint = "/functions"
$listFunctionsUri = $azureRmBaseUri + $azureRmResourceId + $azureRmListFunctionsEndpoint + "?api-version=" + $azureRmApiVersion
$listFunctions = Invoke-RestMethod -Method Get -Uri $listFunctionsUri -Headers $accessTokenHeader
@justinyoo
justinyoo / Get-FunctionKeys.ps1
Created Dec 15, 2017
Dynamic Access to Azure Functions Host Keys without KUDU
View Get-FunctionKeys.ps1
$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
You can’t perform that action at this time.