Azure Application Gateway (4) 设置URL路由 - PowerShell
《Windows Azure Platform 系列文章目录》
本文将介绍如果使用Azure PowerShell,创建Azure Application Gateway URL Routing
请读者在使用之前,请先查看笔者之前的文章:Azure Application Gateway (3) 设置URL路由,熟悉相关的内容
注意:Azure Application Gateway必须在ARM模式下才可以创建。
另外PowerShell模式下,和Portal创建的不一样。
PowerShell模式,并不需要先创建81端口,再创建80端口。PowerShell直接可以使用80端口设置URL Routing
#在弹出窗口登录
Login-AzureRmAccount -EnvironmentName AzureChinaCloud #选择订阅信息
Select-AzureRmSubscription -SubscriptionName "Training" #先手动创建Resource Group,这里设置Resource Group
$resourcegroupname = 'LeiAppGWRG' #手动创建Virtual Network
#同之前的文档一样,这个Virtual Network必须要有2个Subnet
$virtualnetworkname= 'LeiAppGatewayVNet' #设置Application Gateway名称
$appgatewayname = 'LeiAppGateway' #设置Application Gateway公网IP地址
$publicipname = 'LeiAppGatewayPublicIP' #Application Gateway 所在的数据中心
$location= 'China East' #设置端口号
$port=80 $vnet=Get-AzureRmVirtualNetwork -name $virtualnetworkname -ResourceGroupName $resourcegroupname #Application Gateway加入到第2个Subnet里
$subnet=$vnet.Subnets[1] $publicip = New-AzureRmPublicIpAddress -ResourceGroupName $resourcegroupname -name $publicipname -location $location -AllocationMethod Dynamic #Create Application Gateway
$gipconfig = New-AzureRmApplicationGatewayIPConfiguration -Name LeiAppGatewayPublicIP -Subnet $subnet #设置Backend Pool 1
$pool1 = New-AzureRmApplicationGatewayBackendAddressPool -Name imagesBackendPool -BackendIPAddresses 10.0.0.4,10.0.0.5 #设置Backend Pool 2
$pool2 = New-AzureRmApplicationGatewayBackendAddressPool -Name videosBackendPool -BackendIPAddresses 10.0.0.11,10.0.0.12 #设置Backend Pool 1的会话保持,不保持会话
$poolSetting01 = New-AzureRmApplicationGatewayBackendHttpSettings -Name "imagesSetting" -Port $port -Protocol Http -CookieBasedAffinity Disabled -RequestTimeout 120 #设置Backend Pool 2的会话保持,为保持会话
$poolSetting02 = New-AzureRmApplicationGatewayBackendHttpSettings -Name "videosSetting" -Port $port -Protocol Http -CookieBasedAffinity Enabled -RequestTimeout 240 $fipconfig01 = New-AzureRmApplicationGatewayFrontendIPConfig -Name "frontend1" -PublicIPAddress $publicip $fp01 = New-AzureRmApplicationGatewayFrontendPort -Name "fep01" -Port $port $listener = New-AzureRmApplicationGatewayHttpListener -Name "listener01" -Protocol Http -FrontendIPConfiguration $fipconfig01 -FrontendPort $fp01 #设置URL Route,为/images/*
$imagePathRule = New-AzureRmApplicationGatewayPathRuleConfig -Name "pathrule1" -Paths "/images/*" -BackendAddressPool $pool1 -BackendHttpSettings $poolSetting01 #设置URL Route,为/videos/*
$videoPathRule = New-AzureRmApplicationGatewayPathRuleConfig -Name "pathrule2" -Paths "/videos/*" -BackendAddressPool $pool2 -BackendHttpSettings $poolSetting02 #设置DefaultBackendAddressPool
$urlPathMap = New-AzureRmApplicationGatewayUrlPathMapConfig -Name "urlpathmap" -PathRules $videoPathRule, $imagePathRule -DefaultBackendAddressPool $pool1 -DefaultBackendHttpSettings $poolSetting02 $rule01 = New-AzureRmApplicationGatewayRequestRoutingRule -Name "rule1" -RuleType PathBasedRouting -HttpListener $listener -UrlPathMap $urlPathMap #设置Application Gateway Size为Small,实例个数为1个
$sku = New-AzureRmApplicationGatewaySku -Name "Standard_Small" -Tier Standard -Capacity 1 #开始创建Application Gateway
$appgw = New-AzureRmApplicationGateway -Name $appgatewayname -ResourceGroupName $resourcegroupname -Location $location -BackendAddressPools $pool1,$pool2 -BackendHttpSettingsCollection $poolSetting01, $poolSetting02 -FrontendIpConfigurations $fipconfig01 -GatewayIpConfigurations $gipconfig -FrontendPorts $fp01 -HttpListeners $listener -UrlPathMaps $urlPathMap -RequestRoutingRules $rule01 -Sku $sku
Azure Application Gateway (4) 设置URL路由 - PowerShell的更多相关文章
- Azure Application Gateway (3) 设置URL路由
<Windows Azure Platform 系列文章目录> 在之前的文章中,笔者介绍了Azure Web App可以设置URL路由.如下图: 在这里笔者简单介绍一下,首先我们还是创建以 ...
- Azure Application Gateway (1) 入门
<Windows Azure Platform 系列文章目录> 请读者注意,Azure Application Gateway在ASM模式下,只能通过PowerShell创建 具体可以参考 ...
- Azure Application Gateway(一)对后端 Web App 进行负载均衡
一,引言 今天,我们学习一个新的知识点-----Azure Application Gateway,通过Azure 应用程序网关为我么后端的服务提供负载均衡的功能.我们再文章头中大概先了解一下什么是应 ...
- Azure Application Gateway(二)对后端 VM 进行负载均衡
一,引言 上一节有讲到使用 Azure Application Gateway 为我们后端类型为 Web App 的 Demo 项目提供负载均衡,Azure Application Gateway 的 ...
- Azure Application Gateway (5) Application Gateway SSL Offload配置
<Windows Azure Platform 系列文章目录> 之前有个客户提出了一个需求,他们的互联网访问的架构分为两种: 1.第一层是使用Azure Application Gatew ...
- Azure Application Gateway (2) 面向公网的Application Gateway
<Windows Azure Platform 系列文章目录> 本章将介绍如何创建面向公网的Application Gateway,我们需要准备以下工作: 1.创建新的Azure Reso ...
- Windows Azure支持七层负载均衡--Application Gateway
一直以来Windows Azure的负载均衡(Loadbalancer)功能一直被客户诟病,无法其竞争对手(特别是国内的云厂商)匹敌. Windows Azure的负载均衡器是四层的,前期的版本不支持 ...
- 【Azure 事件中心】为应用程序网关(Application Gateway with WAF) 配置诊断日志,发送到事件中心
问题描述 在Application Gateway中,开启WAF(Web application firewall)后,现在需要把访问的日志输出到第三方分析代码中进行分析,如何来获取WAF的诊断日志呢 ...
- Ionic 动态配置url路由的设置
随着Ionic App功能的不断增加,需要路由的url设置就越来越多,不喜欢在config函数中写一堆硬代码,一则不美,二则维护起来也麻烦,能不能把这些数据独立出来呢? 经过查找资料与各种实验,最终找 ...
随机推荐
- Jexus 支持PHP的三种方式
Jexus不仅支持ASP.NET,而且能够通个自带的PHP-FCGI服务以及PHP-FPM等方式灵活支持PHP而且还可以以.NET(Phalanger)方式支持PHP. PHP-FCGI服务支持PHP ...
- 推荐:图片轮播插件Nivo Slider
因为项目需要一款切换样式多一些的轮播插件,不经意找到了NivoSlider,非常好用,比bootstrap要好用,而且样式丰富.值得注意的是,这款插件是在MIT协议下免费的. ...
- .NET垃圾回收(GC)原理
作为.NET进阶内容的一部分,垃圾回收器(简称GC)是必须了解的内容.本着“通俗易懂”的原则,本文将解释CLR中垃圾回收器的工作原理. 基础知识 托管堆(Managed Heap) 先来看MSDN的解 ...
- dofile执行ANDROID APK里面的文件
我使用dofile执行APK文件是不行的,比如 dofile("assets/res/flist")只能先拷贝到writablePath然后再dofile拿到数据后再清除这个临时文 ...
- ASP.NET MVC 5 - 创建连接字符串(Connection String)并使用SQL Server LocalDB
您创建的MovieDBContext类负责处理连接到数据库,并将Movie对象映射到数据库记录的任务中.你可能会问一个问题,如何指定它将连接到数据库? 实际上,确实没有指定要使用的数据库,Entity ...
- Eclipse代码格式化规范
附件()是Eclipse代码格式文件,根据以下步骤导入到Eclipse中,帮助规范代码格式. 导入步骤:1. Window -> Performances2. Java -> Code S ...
- springboot之HelloWorld
简介 为了简化开发Spring的复杂度,Spring提供了SpringBoot可以快速开发一个应用,这里就简单介绍下SpringBoot如何快速开发一个J2EE应用 HelloWorld 首先在gra ...
- css双飞翼布局
双飞翼布局是一种比较灵活的布局,始于淘宝UED,玉伯提出的,他着重介绍的是双飞翼栅格布局. 三列布局为"双飞燕"布局,可以把三栏比作一只鸟,main部分相当是于鸟的身体,而lef ...
- fir.im Weekly - 除了新 MacBook Pro,近期值得关注的移动开发好资源
最近,最引人瞩目的莫过于 Apple 产品发布会,MacBook Pro 的更新可能是四年来变化最大的一版.除了更轻.更薄.性能更好.电力更足之外,最大的变化是加入了Touch Bar,被定义为 Ma ...
- jQuery源码分析系列(38) : 队列操作
Queue队列,如同data数据缓存与Deferred异步模型一样,都是jQuery库的内部实现的基础设施 Queue队列是animate动画依赖的基础设施,整个jQuery中队列仅供给动画使用 Qu ...