Skip to content

Instantly share code, notes, and snippets.

View wsilveiranz's full-sized avatar

Wagner Silveira wsilveiranz

View GitHub Profile
@wsilveiranz
wsilveiranz / API-Policy.xml
Created December 14, 2020 04:29
POlicy to log Headers into Hookbin
<!--
IMPORTANT:
- Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements.
- To apply a policy to the incoming request (before it is forwarded to the backend service), place a corresponding policy element within the <inbound> section element.
- To apply a policy to the outgoing response (before it is sent back to the caller), place a corresponding policy element within the <outbound> section element.
- To add a policy, place the cursor at the desired insertion point and select a policy from the sidebar.
- To remove a policy, delete the corresponding policy statement from the policy document.
- Position the <base> element within a section element to inherit all policies from the corresponding section element in the enclosing scope.
- Remove the <base> element to prevent inheriting policies from the corresponding section element in the enclosing scope.
- Policies are applied in the order of their appearance, from the top down.
@wsilveiranz
wsilveiranz / run.ps1
Created November 20, 2020 10:35
What is my IP Powershell Function
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
$status = [HttpStatusCode]::OK
try {
$response = (Invoke-WebRequest -uri https://ifconfig.me/ip).Content
resources:
- repo: self
pool:
name: Hosted
steps:
- task: AzureResourceGroupDeployment@2
displayName: >-
Azure Deployment: Deploy API products
inputs:
azureSubscription: <service connection>
<policies>
<inbound>
<set-backend-service base-url="*** add your wcf relay address here ***" />
<cache-lookup-value key="@("relaytoken")" variable-name="relaytoken" />
<choose>
<when condition="@(!context.Variables.ContainsKey("relaytoken"))">
<set-variable name="resourceUri" value="@(context.Request.Url.ToString())" />
<!-- an accessKey entry must exist in NameValue -->
<set-variable name="accessKey" value="{{accessKey}}" />
@wsilveiranz
wsilveiranz / Set-LogicAppsState.ps1
Created January 7, 2018 21:52
Sets the state of all logic apps within a resource group.
param([string] $subscriptioname, [string] $resourcegroup, [string]$state)
Get-AzureRmSubscription -SubscriptionName $subscriptioname | Select-AzureRmSubscription
Find-AzureRmResource -ResourceGroupNameContains $resourcegroup -ResourceType Microsoft.Logic/workflows | ForEach-Object {Set-AzureRmLogicApp -ResourceGroupName $_.ResourceGroupName -Name $_.Name -State $state -Force}