%3CLINGO-SUB%20id%3D%22lingo-sub-1150049%22%20slang%3D%22en-US%22%3EDynamic%20IP%20Restriction%20for%20App%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1150049%22%20slang%3D%22en-US%22%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EAzure%20App%20Services%20has%20an%20interesting%20feature%2C%20%22%3CSTRONG%3EDynamic%20IP%20Restriction%3C%2FSTRONG%3E%22%20which%20can%20be%20used%20for%20protection%20against%20attacks%20such%20as%20Distributed%20Denial%20of%20Service.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3ERestrictions%20can%20be%20imposed%20on%20the%20App%20Service%2C%20to%20deny%20access%20based%20on%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%20type%3D%22disc%22%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EThe%20number%20of%20concurrent%20requests%20made.%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EThe%20number%20of%20requests%20made%20in%20certain%20interval%20of%20time.%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EThese%20settings%20can%20be%20configured%20either%20in%20the%20application%20web.config%20or%20applicationHost.xdt%20of%20the%20Azure%20App%20Service.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EThe%20Site%20Extension%20%22Dynamic%20IP%20restriction%20for%20App%20Services%22%20provides%20an%20User%20Interface%20to%20update%20the%20settings.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CBR%20%2F%3E%3C%2FFONT%3E%3CSTRONG%3E%3CU%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3ESteps%20to%20install%20the%20site%20extension%3A%3C%2FFONT%3E%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3ENavigate%20to%20the%20%22Site%20Extensions%22%20tab%20from%20the%20Kudu%20site%20of%20the%20App%20Service.%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_1.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168922i383C5CB70E5223D9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_1.png%22%20alt%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EChoose%20Gallery%20and%20search%20for%20%22Dynamic%22%3C%2FFONT%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_0.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F169071i0C54A9F19F0BDFAB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_0.png%22%20alt%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EClick%20on%20%22%2B%22%20icon%20to%20install%20the%20extension.%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_1.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F169072i83C6F862E13ED8EE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_1.png%22%20alt%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3ERestart%20the%20App%20Service%20post%20installation%20of%20the%20extension.%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FFONT%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_5.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F169073iAD177D53B5E55C6D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_5.png%22%20alt%3D%22clipboard_image_5.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EThe%20following%20tags%20should%20be%20added%20in%20the%20%3CSECURITY%3E%20tag%20of%20the%20web.config%20file%20to%20setup%20Dynamic%20IP%20restriction%3C%2FSECURITY%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EBased%20on%20the%20number%20of%20concurrent%20requests%3A%3C%2FFONT%3E%3CUL%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%22%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EConfiguration%3A%3C%2FFONT%3E%3CFONT%20face%3D%22times%20new%20roman%2Ctimes%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3CSYSTEM.WEBSERVER%3E%20%0A%20%20%20%20%3CSECURITY%3E%20%0A%20%20%20%20%20%20%20%20%3CDYNAMICIPSECURITY%20denyaction%3D%22Forbidden%22%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CDENYBYCONCURRENTREQUESTS%20enabled%3D%22true%22%20maxconcurrentrequests%3D%225%22%3E%3C%2FDENYBYCONCURRENTREQUESTS%3E%20%0A%20%20%20%20%20%20%20%20%3C%2FDYNAMICIPSECURITY%3E%20%0A%20%20%20%20%3C%2FSECURITY%3E%20%0A%3C%2FSYSTEM.WEBSERVER%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EUser%20Interface%20%3A%3C%2FFONT%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_17%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_18%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_19%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_20%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_21%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_22%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_23%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_24%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_25%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_27.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168911i5350D00444423C28%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_27.png%22%20alt%3D%22clipboard_image_27.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EBased%20on%20the%20number%20of%20requests%20received%2C%20in%20a%20specific%20interval%20of%20time%3A%3C%2FFONT%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EConfiguration%3A%3C%2FFONT%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3CSYSTEM.WEBSERVER%3E%20%0A%20%20%20%20%3CSECURITY%3E%0A%20%20%20%20%20%20%20%20%3CDYNAMICIPSECURITY%20denyaction%3D%22Forbidden%22%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CDENYBYREQUESTRATE%20enabled%3D%22true%22%20maxrequests%3D%222%22%20requestintervalinmilliseconds%3D%22200%22%3E%3C%2FDENYBYREQUESTRATE%3E%20%0A%20%20%20%20%20%20%20%20%3C%2FDYNAMICIPSECURITY%3E%0A%20%20%20%20%3C%2FSECURITY%3E%20%0A%3C%2FSYSTEM.WEBSERVER%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EUser%20Interface%20%3A%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_28.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168912i6F13A776B22F6984%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_28.png%22%20alt%3D%22clipboard_image_28.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EThe%20error%20returned%20when%20the%20access%20to%20the%20App%20Service%20is%20restricted%20can%20be%20customized%20using%20the%20denyAction%20attribute%20of%20the%20dynamicIpSecurity%20element.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EThe%20following%20values%20can%20be%20set%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EAbortRequest%20%3A%20returns%20HTTP%20status%20code%200%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EUnauthorized%20%3A%20returns%20HTTP%20status%20code%20401%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EForbidden%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3A%20returns%20HTTP%20status%20code%20403%20(default%20setting)%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3ENotFound%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3A%20returns%20HTTP%20status%20code%20404%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_29.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168913i301D6594BF8B2822%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_29.png%22%20alt%3D%22clipboard_image_29.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EPlease%20note%20that%20the%20sub-status%20code%20for%20the%20request%20will%20be%20502%20if%20the%20request%20goes%20through%20Dynamic%20IP%20restrictions.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EExample%20%3A%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3CSYSTEM.WEBSERVER%3E%20%0A%20%20%20%20%3CSECURITY%3E%0A%20%20%20%20%20%20%20%20%3CDYNAMICIPSECURITY%20denyaction%3D%22NotFound%22%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CDENYBYREQUESTRATE%20enabled%3D%22true%22%20maxrequests%3D%222%22%20requestintervalinmilliseconds%3D%2220%22%3E%3C%2FDENYBYREQUESTRATE%3E%20%0A%20%20%20%20%20%20%20%20%3C%2FDYNAMICIPSECURITY%3E%20%0A%20%20%20%20%3C%2FSECURITY%3E%20%0A%3C%2FSYSTEM.WEBSERVER%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_30.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168914i51A7E6A41D32448E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_30.png%22%20alt%3D%22clipboard_image_30.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EWhen%20the%20above%20snippet%20is%20used%2C%20and%20the%20App%20Service%20receives%20more%20than%202%20requests%20from%20the%20same%20IP%20address%20in%20an%20interval%20of%2020%20milliseconds%2C%20we%20receive%20the%20response%20HTTP%20404%20%E2%80%9CNot%20found%E2%80%9D%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_32.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168916i8727AFBBC4BA2B53%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_32.png%22%20alt%3D%22clipboard_image_32.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EFrom%20Webserver%20Logs%2C%20we%20can%20see%20that%20the%20sub-status%20code%20is%20502%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_33.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168917iD490045E71641F0C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_33.png%22%20alt%3D%22clipboard_image_33.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EIt%20is%20also%20possible%20to%20just%20monitor%20the%20request%20without%20actually%20performing%20the%20action%20on%20the%20request.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3ETo%20achieve%20this%20set%20enableLoggingOnlyMode%20to%20True%20%2C%20in%20dynamicIpSecurity%20element.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3CSYSTEM.WEBSERVER%3E%20%0A%20%20%20%20%3CSECURITY%3E%20%0A%20%20%20%20%20%20%20%20%3CDYNAMICIPSECURITY%20enableloggingonlymode%3D%22true%22%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CDENYBYREQUESTRATE%20enabled%3D%22true%22%20maxrequests%3D%222%22%20requestintervalinmilliseconds%3D%2210000%22%3E%3C%2FDENYBYREQUESTRATE%3E%20%0A%20%20%20%20%20%20%20%20%3C%2FDYNAMICIPSECURITY%3E%0A%20%20%20%20%3C%2FSECURITY%3E%20%0A%3C%2FSYSTEM.WEBSERVER%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_34.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168918iEA8CEC7D192249BF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_34.png%22%20alt%3D%22clipboard_image_34.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EWe%20observe%20that%20the%20status%20and%20sub-status%20code%20for%20the%20requests%20as%20HTTP%20200.502%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22clipboard_image_35.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168919iD4D80D7062C0B7D2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22clipboard_image_35.png%22%20alt%3D%22clipboard_image_35.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3ENote%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EThe%20Site%20Extension%20considers%20the%20Dynamic%20IP%20Restrictions%20configured%20in%20web.config%20file%20and%20applicationHost.xdt%20file.%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%20size%3D%222%22%3EThe%20changes%20made%20through%20the%20User%20Interface%20are%20reflected%20in%20applicationHost.xdt%20file%20only%20and%20would%20require%20a%20restart%20of%20the%20App%20Service.%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1150049%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20App%20Service%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

Azure App Services has an interesting feature, "Dynamic IP Restriction" which can be used for protection against attacks such as Distributed Denial of Service.

Restrictions can be imposed on the App Service, to deny access based on

  • The number of concurrent requests made.
  • The number of requests made in certain interval of time.

These settings can be configured either in the application web.config or applicationHost.xdt of the Azure App Service.

The Site Extension "Dynamic IP restriction for App Services" provides an User Interface to update the settings.


Steps to install the site extension:

  1. Navigate to the "Site Extensions" tab from the Kudu site of the App Service.
    clipboard_image_1.png
  2. Choose Gallery and search for "Dynamic"
    clipboard_image_0.png
  3. Click on "+" icon to install the extension.
    clipboard_image_1.png
  4. Restart the App Service post installation of the extension.
    clipboard_image_5.png

The following tags should be added in the <security> tag of the web.config file to setup Dynamic IP restriction

  • Based on the number of concurrent requests:
    • Configuration:
      <system.webServer> 
          <security> 
              <dynamicIpSecurity denyAction="Forbidden"> 
                  <denyByConcurrentRequests enabled="true" maxConcurrentRequests="5" /> 
              </dynamicIpSecurity > 
          </security> 
      </system.webServer>
    • User Interface :
       
       
       
       
      clipboard_image_27.png
  • Based on the number of requests received, in a specific interval of time:
    • Configuration:
      <system.webServer> 
          <security>
              <dynamicIpSecurity denyAction="Forbidden"> 
                  <denyByRequestRate enabled="true" maxRequests="2" requestIntervalInMilliseconds="200"/> 
              </dynamicIpSecurity >
          </security> 
      </system.webServer>
      
    • User Interface :
      clipboard_image_28.png

The error returned when the access to the App Service is restricted can be customized using the denyAction attribute of the dynamicIpSecurity element.

The following values can be set:

  • AbortRequest : returns HTTP status code 0
  • Unauthorized : returns HTTP status code 401
  • Forbidden       : returns HTTP status code 403 (default setting)
  • NotFound       : returns HTTP status code 404

clipboard_image_29.png

Please note that the sub-status code for the request will be 502 if the request goes through Dynamic IP restrictions.

Example :

 

<system.webServer> 
    <security>
        <dynamicIpSecurity denyAction="NotFound"> 
            <denyByRequestRate enabled="true" maxRequests="2" requestIntervalInMilliseconds="20"/> 
        </dynamicIpSecurity > 
    </security> 
</system.webServer>

 

clipboard_image_30.png

When the above snippet is used, and the App Service receives more than 2 requests from the same IP address in an interval of 20 milliseconds, we receive the response HTTP 404 “Not found”

clipboard_image_32.png

From Webserver Logs, we can see that the sub-status code is 502

clipboard_image_33.png

It is also possible to just monitor the request without actually performing the action on the request.

To achieve this set enableLoggingOnlyMode to True , in dynamicIpSecurity element.

 

<system.webServer> 
    <security> 
        <dynamicIpSecurity enableLoggingOnlyMode="true" > 
            <denyByRequestRate enabled="true" maxRequests="2" requestIntervalInMilliseconds="10000"/> 
        </dynamicIpSecurity >
    </security> 
</system.webServer>

 

clipboard_image_34.png

We observe that the status and sub-status code for the requests as HTTP 200.502

clipboard_image_35.png

Note:

  • The Site Extension considers the Dynamic IP Restrictions configured in web.config file and applicationHost.xdt file.
  • The changes made through the User Interface are reflected in applicationHost.xdt file only and would require a restart of the App Service.