%3CLINGO-SUB%20id%3D%22lingo-sub-1594677%22%20slang%3D%22en-US%22%3EZero%20to%20Hero%20with%20App%20Service%2C%20Part%206%3A%20Securing%20your%20web%20app%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1594677%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20Azure%20App%20Service%20is%20offered%20as%20two%20deployment%20types%3A%20the%20multi-tenant%20service%20and%20the%20App%20Service%20Environment.%20In%20the%20multi-tenant%20service%20there%20are%20thousands%20of%20customers%20on%20the%20same%20infrastructure.%20Your%20apps%20are%20always%20secured%20but%20the%20network%2C%20the%20address%20space%20and%20some%20other%20components%20are%20shared.%20In%20an%20App%20Service%20Environment%20you%20have%20a%20single%20tenant%20version%20of%20App%20Service%20that%20runs%20in%20your%20Azure%20Virtual%20Network.%20The%20next%20two%20articles%20are%20focused%20on%20how%20to%20configure%20network%20security%20in%20the%20multi-tenant%20App%20Service.%3C%2FP%3E%0A%3CP%3EIn%20this%20article%2C%20you%20will%20learn%20how%20to%20secure%20your%20standalone%20app%20in%20the%20multi-tenant%20App%20Service.%20In%20the%20next%20article%2C%20we%20will%20cover%20how%20to%20build%20a%20secure%20multi-tier%20web%20application.%3C%2FP%3E%0A%3CH2%20id%3D%22networking-overview%22%20class%3D%22%22%20id%3D%22toc-hId--1293512937%22%20id%3D%22toc-hId--1293512936%22%20id%3D%22toc-hId--1293512936%22%3ENetworking%20overview%3C%2FH2%3E%0A%3CP%3EThere%20are%20two%20aspects%20that%20need%20to%20be%20secured%20for%20a%20web%20app%2C%20inbound%20traffic%20and%20outbound%20traffic.%20Inbound%20traffic%20are%20visitors%20going%20to%20your%20web%20page%2C%20or%20clients%20sending%20requests%20to%20your%20API.%20Outbound%20traffic%20is%20when%20your%20web%20app%20makes%20an%20outbound%20call%20to%20a%20database%2C%20cache%2C%20message%20queue%2C%20or%20other%20service.%20The%20inbound%20traffic%20passes%20through%20a%20load%20balancer%20to%20a%20set%20of%20shared%20front%20end%20servers%20before%20reaching%20the%20workers%20which%20your%20apps%20run%20on.%20The%20outbound%20traffic%20leaves%20those%20workers%20and%20goes%20out%20through%20one%20of%20the%20outbound%20load%20balancers%20used%20by%20the%20scale%20unit.%20In%20the%20diagram%20below%2C%20the%20inbound%20and%20outbound%20load%20balancers%20are%20shown%20in%20green.%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorChristina%20Compy_0%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22app-service-architecture.png%22%20style%3D%22width%3A%20890px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F212936iFA67F64A961CC31E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22app-service-architecture.png%22%20alt%3D%22app-service-architecture.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAll%20traffic%20to%20and%20from%20the%20components%20inside%20App%20Service%20is%20strictly%20locked%20down%20and%20secured%20to%20prevent%20malicious%20actions.%20This%20includes%20preventing%20any%20worker-to-worker%20communication.%20This%20means%20users%20just%20need%20to%20secure%20the%20networking%20path%20to%20and%20from%20their%20apps%E2%80%93all%20other%20traffic%20is%20secured%20for%20you.%3C%2FP%3E%0A%3CH3%20id%3D%22features-and-services%22%20class%3D%22%22%20id%3D%22toc-hId--602951463%22%20id%3D%22toc-hId--602951462%22%20id%3D%22toc-hId--602951462%22%3EFeatures%20and%20Services%3C%2FH3%3E%0A%3CP%3EThe%20following%20tutorial%20uses%20a%20number%20of%20Azure%20Networking%20features%20and%20services.%20Here%20is%20a%20quick%20breakdown%20of%20the%20features%20used%20in%20this%20article.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fweb-application-firewall%2Fag%2Fag-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EWeb%20Application%20Firewall%3C%2FA%3E%3A%20The%20Web%20Application%20Firewall%20(or%20WAF%20for%20short)%20sits%20between%20your%20applications%20and%20your%20end%20users.%20It%20protects%20your%20applications%20against%20common%20attacks%20like%20cross-site-scripting%20or%20SQL%20injection.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvirtual-network%2Fvirtual-networks-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EVirtual%20Network%3C%2FA%3E%3A%20The%20Azure%20Virtual%20Network%20(VNet)%20is%20the%20building%20block%20for%20creating%20your%20network%20in%20Azure.%20A%20VNet%20is%20similar%20to%20a%20physical%20network%20that%20you%20would%20have%20in%20an%20on-premises%20network%3A%20you%20can%20assign%20an%20address%20space%20for%20a%20VNet%20and%20apply%20subnets%20to%20organize%20the%20network.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapplication-gateway%2Foverview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EApplication%20Gateway%3C%2FA%3E%3A%20An%20Application%20Gateway%20acts%20as%20a%20load%20balancer%20for%20your%20application(s)%20and%20allows%20you%20to%20route%20requests%20based%20on%20the%20requested%20hostname%20or%20URL%20path.%20Learn%20more%20about%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapplication-gateway%2Ffeatures%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Application%20Gateway%20features%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvirtual-network%2Fvirtual-network-service-endpoints-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EService%20endpoints%3C%2FA%3E%3A%20Some%20Azure%20resources%20are%20deployed%20into%20virtual%20networks%20by%20default.%20Other%20resources%2C%20such%20as%20the%20multi-tenant%20App%20Service%2C%20can%20gain%20access%20to%20the%20VNet%20using%20Service%20Endpoints.%20This%20means%20you%20can%20use%20Service%20Endpoints%20to%20only%20allow%20inbound%20traffic%20to%20your%20web%20app%20from%20a%20subnet%20within%20a%20VNet.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fprivate-link%2Fprivate-endpoint-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPrivate%20Endpoints%3C%2FA%3E%3A%20Private%20Endpoints%20enable%20exposing%20the%20inbound%20traffic%20to%20a%20service%20on%20an%20address%20in%20a%20selected%20VNet.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Ffrontdoor%2Ffront-door-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Front%20Door%3C%2FA%3E%3A%20Front%20Door%20(AFD)%20provides%20many%20of%20the%20same%20features%20and%20benefits%20of%20an%20Application%20Gateway.%20It%20improves%20application%20performance%20by%20routing%20users%20to%20the%20nearest%20Point%20of%20Presence%20(POP).%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22securing-your-web-app%22%20class%3D%22%22%20id%3D%22toc-hId--613454567%22%20id%3D%22toc-hId--613454566%22%20id%3D%22toc-hId--613454566%22%3ESecuring%20your%20web%20app%3C%2FH2%3E%0A%3CP%3ETo%20secure%20the%20network%20access%20around%20your%20web%20app%20you%20will%20need%20to%20secure%E2%80%A6%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fantares-blog-staging-pr-136.azurewebsites.net%2F2020%2F08%2F14%2Fzero_to_hero_pt6.html%23securing-inbound-traffic%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EInbound%20request%20traffic%20to%20your%20app%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fantares-blog-staging-pr-136.azurewebsites.net%2F2020%2F08%2F14%2Fzero_to_hero_pt6.html%23secure-publishing-inbound-traffic%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EInbound%20publishing%20traffic%20to%20your%20app%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fantares-blog-staging-pr-136.azurewebsites.net%2F2020%2F08%2F14%2Fzero_to_hero_pt6.html%23secure-outbound-traffic-from-your-web-app%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EOutbound%20calls%20made%20from%20your%20app%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ETo%20secure%20inbound%20request%20traffic%20to%20your%20app%2C%20use%20a%20WAF%20enabled%20Application%20Gateway%20with%20Service%20Endpoints.%20To%20secure%20inbound%20publishing%20traffic%20to%20your%20app%2C%20use%20a%20build%20agent%20with%20service%20endpoints%20on%20the%20publishing%20endpoint.%20Lastly%2C%20to%20secure%20outbound%20traffic%20from%20your%20web%20app%2C%20use%20VNet%20Integration%20and%20an%20Azure%20Firewall.%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorChristina%20Compy_1%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22secure-web-app.png%22%20style%3D%22width%3A%20468px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F212937i55EB73DA03356D65%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22secure-web-app.png%22%20alt%3D%22secure-web-app.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH3%20id%3D%22securing-inbound-traffic%22%20class%3D%22%22%20id%3D%22toc-hId-77106907%22%20id%3D%22toc-hId-77106908%22%20id%3D%22toc-hId-77106908%22%3ESecuring%20inbound%20traffic%3C%2FH3%3E%0A%3COL%3E%0A%3CLI%3ESelect%20or%20create%20an%20Azure%20Virtual%20Network%20(VNet).%20To%20secure%20your%20inbound%20traffic%20to%20your%20app%20you%20will%20need%20to%20have%20a%20VNet.%20If%20you%20have%20one%20already%2C%20you%20do%20not%20need%20to%20create%20another.%20It%20should%20be%20in%20the%20same%20region%20as%20your%20web%20app.%20If%20you%20do%20not%20have%20a%20VNet%2C%20you%20can%20create%20one%20following%20these%20instructions%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvirtual-network%2Fquick-create-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ECreating%20an%20Azure%20Virtual%20Network%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3ECreate%20an%20Application%20Gateway%20as%20described%20here%20in%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapplication-gateway%2Fquick-create-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ECreating%20an%20Application%20Gateway%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3EEnable%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapp-service%2Fapp-service-ip-restrictions%23service-endpoints%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EService%20Endpoints%3C%2FA%3E%20to%20your%20web%20app.%3C%2FLI%3E%0A%3CLI%3EOnce%20you%20have%20the%20VNet%2C%20App%20Gateway%2C%20and%20Service%20Endpoints%20set%20up%2C%20you%20need%20to%20add%20a%20custom%20domain%20name%20for%20your%20app%20that%20should%20point%20to%20your%20Application%20Gateway.%20Your%20web%20app%20needs%20to%20be%20configured%20with%20the%20new%20domain%20name.%20To%20add%20a%20custom%20domain%20name%20to%20your%20web%20app%2C%20follow%20the%20guidance%20here.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThe%20end%20result%20is%20that%20your%20web%20app%20will%20have%20all%20inbound%20traffic%20routed%20through%20your%20Application%20Gateway%20to%20your%20app.%20You%20can%2C%20and%20should%2C%20enable%20Web%20Application%20Firewall%20(WAF)%20support%20on%20your%20Application%20Gateway.%3C%2FP%3E%0A%3CH4%20id%3D%22alternate-configuration%22%20class%3D%22%22%20id%3D%22toc-hId-767668381%22%20id%3D%22toc-hId-767668382%22%20id%3D%22toc-hId-767668382%22%3EAlternate%20Configuration%3C%2FH4%3E%0A%3CP%3EThere%20are%20two%20alternative%20services%20that%20are%20in%20preview%20that%20should%20be%20noted.%20One%20is%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapp-service%2Fnetworking%2Fprivate-endpoint%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPrivate%20Endpoints%3C%2FA%3E%20rather%20than%20Service%20Endpoints%20and%20the%20other%20is%20using%20Azure%20Front%20Door%20instead%20of%20an%20Application%20Gateway.%3C%2FP%3E%0A%3CP%3EIf%20you%20use%20Private%20Endpoints%20instead%20of%20Service%20Endpoints%2C%20you%20would%20create%20your%20Private%20Endpoint%20in%20a%20subnet%20other%20than%20the%20GatewaySubnet.%20This%20Private%20Endpoint%20would%20be%20configured%20against%20your%20app.%20This%20is%20a%20great%20solution%20as%20it%20also%20hosts%20the%20HTTPS%20publishing%20endpoint%20for%20your%20app.%20When%20you%20add%20Private%20Endpoints%20to%20your%20app%2C%20the%20app%20is%20no%20longer%20accessible%20from%20the%20internet.%20Traffic%20to%20your%20app%20must%20only%20go%20through%20the%20private%20endpoints%20on%20your%20app.%3C%2FP%3E%0A%3CP%3EIf%20you%20use%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Ffrontdoor%2Ffront-door-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Front%20Door%3C%2FA%3E%20(AFD)%20with%20your%20app%2C%20you%20would%20need%20to%20set%20an%20IP%20address%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapp-service%2Fapp-service-ip-restrictions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eaccess%20restriction%3C%2FA%3E%20to%20secure%20your%20app%20to%20only%20being%20accessible%20through%20AFD.%20There%20are%20some%20additional%20changes%20that%20will%20soon%20be%20available%20that%20will%20enable%20you%20to%20lock%20you%20app%20down%20to%20specific%20AFD%20profiles.%20If%20you%20use%20AFD%2C%20you%20can%20enable%20a%20mix%20of%20capabilities%20such%20as%20WAF%20protection%20just%20like%20with%20an%20Application%20Gateway.%3C%2FP%3E%0A%3CH3%20id%3D%22secure-publishing-inbound-traffic%22%20class%3D%22%22%20id%3D%22toc-hId-757165277%22%20id%3D%22toc-hId-757165278%22%20id%3D%22toc-hId-757165278%22%3ESecure%20publishing%20inbound%20traffic%3C%2FH3%3E%0A%3CP%3EPublishing%20is%20the%20process%20by%20which%20you%20upload%20your%20web%20app%20content%20to%20your%20app%20service%20instance.%20Unless%20you%20are%20using%20FTP%2C%20all%20publishing%20actions%20are%20performed%20against%20the%20scm%20site%20for%20your%20app.%20For%20every%20app%20there%20exists%20the%20app%20url%20and%20there%20also%20exists%20the%20publishing%20url.%20The%20publishing%20url%20is%20%3CEM%3E%3CAPP%20name%3D%22%22%3E.scm.azurewebsites.net%3C%2FAPP%3E%3C%2FEM%3E.%20Secure%20publishing%20is%20not%20too%20different%20from%20secure%20app%20access.%20For%20secure%20publishing%20you%20need%20to%20publish%20from%20inside%20your%20VNet.%20To%20have%20a%20secure%20publishing%20story%20you%20need%20to%20follow%20one%20of%20the%20following%20patterns%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EUse%20Access%20Restrictions%20to%20secure%20traffic%20to%20the%20publishing%20endpoint%20for%20your%20app%3C%2FLI%3E%0A%3CLI%3EUse%20service%20endpoints%20to%20secure%20traffic%20from%20a%20jump%20box%20being%20used%20to%20publish%3C%2FLI%3E%0A%3CLI%3EUse%20a%20relay%20agent%2C%20such%20as%20the%20Azure%20Pipeline%20build%20agent%20deployed%20on%20a%20VM%20in%20your%20VNet%20and%20then%20use%20service%20endpoints%20to%20secure%20your%20scm%20site%20to%20the%20subnet%20that%20the%20build%20agent%20is%20in.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ETo%20use%20the%20Azure%20Pipeline%20relays%20agent%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ECreate%20a%20VM%20in%20your%20VNet.%3C%2FLI%3E%0A%3CLI%3EInstall%20and%20configure%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fdevops%2Fpipelines%2Ftasks%2Fdeploy%2Fazure-rm-web-app-deployment%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20pipeline%20agent%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EConfigure%20service%20endpoints%20for%20your%20app%20scm%20site%20against%20the%20subnet%20that%20your%20VM%20is%20in.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22secure-outbound-traffic-from-your-web-app%22%20class%3D%22active%22%20id%3D%22toc-hId--1050289186%22%20id%3D%22toc-hId--1050289185%22%20id%3D%22toc-hId--1050289185%22%3ESecure%20outbound%20traffic%20from%20your%20web%20app%3C%2FH3%3E%0A%3CP%3ETo%20secure%20outbound%20traffic%20from%20your%20web%20app%20you%20need%20to%20use%20the%20regional%20VNet%20Integration%20feature.%20This%20feature%20enables%20you%20to%20make%20calls%20into%20your%20VNet%20and%20have%20all%20outbound%20traffic%20subject%20to%20Network%20Security%20Groups%20(NSGs)%20and%20Route%20Tables%20(UDRs).%20With%20NSGs%20you%20can%20restrict%20outbound%20traffic%20to%20address%20blocks%20of%20your%20choosing.%20With%20UDRs%20you%20can%20route%20traffic%20as%20you%20see%20fit.%20If%20you%20route%20the%20outbound%20traffic%20to%20an%20Azure%20Firewall%20device%2C%20you%20can%20restrict%20your%20outbound%20internet%20traffic%20to%20only%20the%20FQDN%E2%80%99s%20you%20want%20it%20to%20reach.%3C%2FP%3E%0A%3CP%3ETo%20secure%20your%20outbound%20traffic%20from%20your%20web%20app%2C%20enable%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapp-service%2Fweb-sites-integrate-with-vnet%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EVNet%20Integration%3C%2FA%3E.%20By%20default%2C%20your%20app%20outbound%20traffic%20will%20only%20be%20affected%20by%20NSGs%20and%20UDRs%20if%20you%20are%20going%20to%20a%20private%20address%20(10.0.0.0%2F8%2C%20172.16.0.0%2F12%2C%20192.168.0.0%2F16).%20To%20ensure%20that%20all%20of%20your%20outbound%20traffic%20is%20affected%20by%20the%20NSGs%20and%20UDRs%20on%20your%20integration%20subnet%2C%20set%20the%20application%20setting%20WEBSITE_VNET_ROUTE_ALL%20to%201.%3C%2FP%3E%0A%3CH2%20id%3D%22summary%22%20class%3D%22%22%20id%3D%22toc-hId--1060792290%22%20id%3D%22toc-hId--1060792289%22%20id%3D%22toc-hId--1060792289%22%3ESummary%3C%2FH2%3E%0A%3CP%3ECongratulations!%20In%20this%20article%20you%20learned%20how%20to%20secure%20your%20inbound%20and%20outbound%20networking%20traffic.%20You%20are%20now%20able%20to%20assemble%20App%20Service%20and%20Networking%20features%20to%20create%20a%20secure%20internet%20facing%20web%20application.%3C%2FP%3E%0A%3CH3%20id%3D%22helpful-resources%22%20class%3D%22%22%20id%3D%22toc-hId--370230816%22%20id%3D%22toc-hId--370230815%22%20id%3D%22toc-hId--370230815%22%3EHelpful%20Resources%3C%2FH3%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapp-service%2Fnetworking-features%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EApp%20Service%20networking%20features%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapp-service%2Fapp-service-ip-restrictions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EApp%20Service%20access%20restrictions%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapp-service%2Fweb-sites-integrate-with-vnet%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EApp%20Service%20VNet%20Integration%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapp-service%2Fnetworking%2Fprivate-endpoint%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EApp%20Service%20Private%20endpoints%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fapp-service%2Fapp-service-hybrid-connections%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EApp%20Service%20Hybrid%20Connections%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1594677%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20Azure%20App%20Service%20is%20offered%20as%20two%20deployment%20types%3A%20the%20multi-tenant%20service%20and%20the%20App%20Service%20Environment.%20In%20the%20multi-tenant%20service%20there%20are%20thousands%20of%20customers%20on%20the%20same%20infrastructure.%20Your%20apps%20are%20always%20secured%20but%20the%20network%2C%20the%20address%20space%20and%20some%20other%20components%20are%20shared.%20In%20an%20App%20Service%20Environment%20you%20have%20a%20single%20tenant%20version%20of%20App%20Service%20that%20runs%20in%20your%20Azure%20Virtual%20Network.%20The%20next%20two%20articles%20are%20focused%20on%20how%20to%20configure%20network%20security%20in%20the%20multi-tenant%20App%20Service.%3C%2FP%3E%0A%3CP%3EIn%20this%20article%2C%20you%20will%20learn%20how%20to%20secure%20your%20standalone%20app%20in%20the%20multi-tenant%20App%20Service.%20In%20the%20next%20article%2C%20we%20will%20cover%20how%20to%20build%20a%20secure%20multi-tier%20web%20application.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1594677%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20App%20Service%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWeb%20Apps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1595317%22%20slang%3D%22en-US%22%3ERe%3A%20Zero%20to%20Hero%20with%20App%20Service%2C%20Part%206%3A%20Securing%20your%20web%20app%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1595317%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20for%20Sharing%20with%20the%20Community%26nbsp%3B%3CIMG%20class%3D%22lia-deferred-image%20lia-image-emoji%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Fhtml%2Fimages%2Femoticons%2Fcool_40x40.gif%22%20alt%3D%22%3Acool%3A%22%20title%3D%22%3Acool%3A%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

The Azure App Service is offered as two deployment types: the multi-tenant service and the App Service Environment. In the multi-tenant service there are thousands of customers on the same infrastructure. Your apps are always secured but the network, the address space and some other components are shared. In an App Service Environment you have a single tenant version of App Service that runs in your Azure Virtual Network. The next two articles are focused on how to configure network security in the multi-tenant App Service.

In this article, you will learn how to secure your standalone app in the multi-tenant App Service. In the next article, we will cover how to build a secure multi-tier web application.

Networking overview

There are two aspects that need to be secured for a web app, inbound traffic and outbound traffic. Inbound traffic are visitors going to your web page, or clients sending requests to your API. Outbound traffic is when your web app makes an outbound call to a database, cache, message queue, or other service. The inbound traffic passes through a load balancer to a set of shared front end servers before reaching the workers which your apps run on. The outbound traffic leaves those workers and goes out through one of the outbound load balancers used by the scale unit. In the diagram below, the inbound and outbound load balancers are shown in green.

 

app-service-architecture.png

 

All traffic to and from the components inside App Service is strictly locked down and secured to prevent malicious actions. This includes preventing any worker-to-worker communication. This means users just need to secure the networking path to and from their apps–all other traffic is secured for you.

Features and Services

The following tutorial uses a number of Azure Networking features and services. Here is a quick breakdown of the features used in this article.

  • Web Application Firewall: The Web Application Firewall (or WAF for short) sits between your applications and your end users. It protects your applications against common attacks like cross-site-scripting or SQL injection.
  • Virtual Network: The Azure Virtual Network (VNet) is the building block for creating your network in Azure. A VNet is similar to a physical network that you would have in an on-premises network: you can assign an address space for a VNet and apply subnets to organize the network.
  • Application Gateway: An Application Gateway acts as a load balancer for your application(s) and allows you to route requests based on the requested hostname or URL path. Learn more about Azure Application Gateway features
  • Service endpoints: Some Azure resources are deployed into virtual networks by default. Other resources, such as the multi-tenant App Service, can gain access to the VNet using Service Endpoints. This means you can use Service Endpoints to only allow inbound traffic to your web app from a subnet within a VNet.
  • Private Endpoints: Private Endpoints enable exposing the inbound traffic to a service on an address in a selected VNet.
  • Azure Front Door: Front Door (AFD) provides many of the same features and benefits of an Application Gateway. It improves application performance by routing users to the nearest Point of Presence (POP).

Securing your web app

To secure the network access around your web app you will need to secure…

  1. Inbound request traffic to your app
  2. Inbound publishing traffic to your app
  3. Outbound calls made from your app

To secure inbound request traffic to your app, use a WAF enabled Application Gateway with Service Endpoints. To secure inbound publishing traffic to your app, use a build agent with service endpoints on the publishing endpoint. Lastly, to secure outbound traffic from your web app, use VNet Integration and an Azure Firewall.

 

secure-web-app.png

Securing inbound traffic

  1. Select or create an Azure Virtual Network (VNet). To secure your inbound traffic to your app you will need to have a VNet. If you have one already, you do not need to create another. It should be in the same region as your web app. If you do not have a VNet, you can create one following these instructions Creating an Azure Virtual Network.
  2. Create an Application Gateway as described here in Creating an Application Gateway.
  3. Enable Service Endpoints to your web app.
  4. Once you have the VNet, App Gateway, and Service Endpoints set up, you need to add a custom domain name for your app that should point to your Application Gateway. Your web app needs to be configured with the new domain name. To add a custom domain name to your web app, follow the guidance here.

The end result is that your web app will have all inbound traffic routed through your Application Gateway to your app. You can, and should, enable Web Application Firewall (WAF) support on your Application Gateway.

Alternate Configuration

There are two alternative services that are in preview that should be noted. One is using Private Endpoints rather than Service Endpoints and the other is using Azure Front Door instead of an Application Gateway.

If you use Private Endpoints instead of Service Endpoints, you would create your Private Endpoint in a subnet other than the GatewaySubnet. This Private Endpoint would be configured against your app. This is a great solution as it also hosts the HTTPS publishing endpoint for your app. When you add Private Endpoints to your app, the app is no longer accessible from the internet. Traffic to your app must only go through the private endpoints on your app.

If you use Azure Front Door (AFD) with your app, you would need to set an IP address access restriction to secure your app to only being accessible through AFD. There are some additional changes that will soon be available that will enable you to lock you app down to specific AFD profiles. If you use AFD, you can enable a mix of capabilities such as WAF protection just like with an Application Gateway.

Secure publishing inbound traffic

Publishing is the process by which you upload your web app content to your app service instance. Unless you are using FTP, all publishing actions are performed against the scm site for your app. For every app there exists the app url and there also exists the publishing url. The publishing url is <app name>.scm.azurewebsites.net. Secure publishing is not too different from secure app access. For secure publishing you need to publish from inside your VNet. To have a secure publishing story you need to follow one of the following patterns:

  • Use Access Restrictions to secure traffic to the publishing endpoint for your app
  • Use service endpoints to secure traffic from a jump box being used to publish
  • Use a relay agent, such as the Azure Pipeline build agent deployed on a VM in your VNet and then use service endpoints to secure your scm site to the subnet that the build agent is in.

To use the Azure Pipeline relays agent:

  1. Create a VM in your VNet.
  2. Install and configure the Azure pipeline agent
  3. Configure service endpoints for your app scm site against the subnet that your VM is in.

Secure outbound traffic from your web app

To secure outbound traffic from your web app you need to use the regional VNet Integration feature. This feature enables you to make calls into your VNet and have all outbound traffic subject to Network Security Groups (NSGs) and Route Tables (UDRs). With NSGs you can restrict outbound traffic to address blocks of your choosing. With UDRs you can route traffic as you see fit. If you route the outbound traffic to an Azure Firewall device, you can restrict your outbound internet traffic to only the FQDN’s you want it to reach.

To secure your outbound traffic from your web app, enable VNet Integration. By default, your app outbound traffic will only be affected by NSGs and UDRs if you are going to a private address (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). To ensure that all of your outbound traffic is affected by the NSGs and UDRs on your integration subnet, set the application setting WEBSITE_VNET_ROUTE_ALL to 1.

Summary

Congratulations! In this article you learned how to secure your inbound and outbound networking traffic. You are now able to assemble App Service and Networking features to create a secure internet facing web application.

Helpful Resources

1 Comment

Thank you for Sharing with the Community :cool: