Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabrício Sanchez fabriciosanchez

View GitHub Profile
View clickstream.manifest.cdm.json
{
"jsonSchemaSemanticVersion": "1.0.0",
"imports": [],
"manifestName": "clickstream",
"explanation": "CDM standard entities",
"entities": [
{
"type": "LocalEntity",
"entityName": "Comments",
"entityPath": "Comments.cdm.json/Comments"
View Comments.cdm.json
{
"$schema": "../schema.cdm.json",
"jsonSchemaSemanticVersion": "1.0.0",
"imports": [
{
"corpusPath": "/foundations.cdm.json"
},
{
"corpusPath": "/meanings.cdm.json"
}
@fabriciosanchez
fabriciosanchez / ag-update.ps1
Created Apr 11, 2020
Updates the application gateway.
View ag-update.ps1
$appgw = Set-AzApplicationGateway `
-ApplicationGateway $appgw
@fabriciosanchez
fabriciosanchez / ag-request-routing.ps1
Created Apr 11, 2020
Creates the request routing piece.
View ag-request-routing.ps1
$appgw = Add-AzApplicationGatewayRequestRoutingRule `
-ApplicationGateway $appgw `
-Name "apim-api-external-rule" `
-RuleType PathBasedRouting `
-HttpListener $listener `
-BackendAddressPool $Pool `
-BackendHttpSettings $poolSettings `
-UrlPathMap $pathMap
@fabriciosanchez
fabriciosanchez / ag-url-path-map.ps1
Created Apr 11, 2020
Creates a configuration object to url path map.
View ag-url-path-map.ps1
$pathmap = Get-AzApplicationGatewayUrlPathMapConfig `
-ApplicationGateway $appgw `
-Name "external-urlpathmapconfig"
@fabriciosanchez
fabriciosanchez / ag-path-rule-mapping.ps1
Created Apr 11, 2020
Creates the mapping of the existing rule and applies it to the AG.
View ag-path-rule-mapping.ps1
$appgw = Add-AzApplicationGatewayUrlPathMapConfig `
-ApplicationGateway $appgw `
-Name "external-urlpathmapconfig" `
-PathRules $pathRule `
-DefaultBackendAddressPool $sinkpool `
-DefaultBackendHttpSettings $poolSettings
$appgw = Set-AzApplicationGateway `
-ApplicationGateway $appgw
@fabriciosanchez
fabriciosanchez / ag-path-rule-external.ps1
Created Apr 11, 2020
Creating a path rule configuration for external calls.
View ag-path-rule-external.ps1
$pathRule = New-AzApplicationGatewayPathRuleConfig `
-Name "external" `
-Paths "/external/*" `
-BackendAddressPool $pool `
-BackendHttpSettings $poolSettings
View ag-retrieve-information.ps1
# Get existing Application Gateway config
$appgw = Get-AzApplicationGateway `
-ResourceGroupName $resGroupName `
-Name $appgwName
$listener = Get-AzApplicationGatewayHttpListener `
-Name "apim-api-listener" `
-ApplicationGateway $appgw
$sinkpool = Get-AzApplicationGatewayBackendAddressPool `
View ag-final-conf-deploy.ps1
# step 11 - change App Gateway SKU and instances (# instances can be configured as required)
$sku = New-AzApplicationGatewaySku -Name "WAF_Medium" -Tier "WAF" -Capacity 1
# step 12 - configure WAF to be in prevention mode
$config = New-AzApplicationGatewayWebApplicationFirewallConfiguration `
-Enabled $true `
-FirewallMode "Detection"
# Deploy the App Gateway
$appgwName = "aumanager-apim-app-gw"
@fabriciosanchez
fabriciosanchez / ag-rule-developer-portal.ps1
Created Apr 10, 2020
Creates a rule that directs external users to APIM's developers portal.
View ag-rule-developer-portal.ps1
# step 10 - create a routing rule to allow external Internet access to the developer portal
$rule01 = New-AzApplicationGatewayRequestRoutingRule `
-Name "apim-portal-rule" `
-RuleType Basic `
-HttpListener $portalListener `
-BackendAddressPool $apimProxyBackendPool `
-BackendHttpSettings $apimPoolPortalSetting