Framework/Configurations/SVT/Services/AppService.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
  {
  "FeatureName": "AppService",
  "Reference": "aka.ms/azsktcp/appservice",
  "IsMaintenanceMode": false,
    "Controls": [
      {
        "ControlID": "Azure_AppService_AuthZ_Grant_Min_RBAC_Access",
        "Description": "All users/identities must be granted minimum required permissions using Role Based Access Control (RBAC)",
        "Id": "AppService110",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckRBACAccess",
        "Rationale": "Granting minimum access by leveraging RBAC feature ensures that users are granted just enough permissions to perform their tasks. This minimizes exposure of the resources in case of user/service account compromise.",
        "Recommendation": "Remove any excessive privileges granted on the App Service. Run command: Remove-AzRoleAssignment -SignInName '<SignInName>' -Scope '<Scope>' RoleDefinitionName '<RoleDefinitionName>'. Run 'Get-Help Remove-AzRoleAssignment -full' for more help.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "AuthZ",
          "RBAC",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_DP_Use_CNAME_With_SSL",
        "Description": "Custom domain with SSL binding must be configured for App Service",
        "Id": "AppService120",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceCustomDomainWithSSLConfig",
        "Rationale": "Use of custom domain protects a web application from common attacks such as phishing, session hijacking and other DNS-related attacks.",
        "Recommendation": "Go to Azure Portal --> your App Service --> Settings --> Custom Domains and follow the steps mentioned to configure a custom domain. Run command 'New-AzWebAppSSLBinding' to enable the SSL binding for your custom domain. Run 'Get-Help New-AzWebAppSSLBinding -full' for more help.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "DP",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_AuthN_Use_AAD_for_Client_AuthN",
        "Description": "App Service must authenticate users using Azure Active Directory backed credentials",
        "Id": "AppService130",
        "ControlSeverity": "High",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceADAuthentication",
        "Rationale": "Using the native enterprise directory for authentication ensures that there is a built-in high level of assurance in the user identity established for subsequent access control.All Enterprise subscriptions are automatically associated with their enterprise directory (xxx.onmicrosoft.com) and users in the native directory are trusted for authentication to enterprise subscriptions.",
        "Recommendation": "Go to Azure Portal --> your App Service --> Settings --> Authentication/Authorization --> turn on 'App Service Authentication' --> Click on 'Azure Active Directory' under Authentication Providers to configure the AAD authentication. There will be a list of options to choose from under 'Action to take when request is not authenticated'. Please make sure that this value is not set to 'Allow Anonymous requests (no action)'. Note: If you are implementing this control via code, then you can attest to the same and mark this as passed. Note: In case of Functions apps, AAD authentication is required only for 'Http Trigger' functions.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "AuthN",
          "OwnerAccess",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_Deploy_Dont_Use_Publish_Profiles",
        "Description": "Publish profile credentials must not be used for App Service deployment",
        "Id": "AppService140",
        "ControlSeverity": "High",
        "Automated": "No",
        "MethodName": "",
        "Rationale": "Publish profile of App Services contains deployment and FTP credentials. There are 2 risks with this. First, the credentials can get easily leaked during the various workflows involving the publish profile. Secondly, use of public profiles weakens auditability of deployment actions.",
        "Recommendation": "No predefined role should be present in the App Service and all the custom roles must have all 'publishxml' operations added as the Non Actions, e.g. 'microsoft.web/sites/publishxml/read'. Refer https://docs.microsoft.com/en-us/azure/app-service/faq-deployment#i-am-just-getting-started-with-app-service-web-apps-how-do-i-publish-my-code for exploring ways to securely deploy app service.",
        "Tags": [
          "SDL",
          "TCP",
          "Manual",
          "Deploy",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_AuthZ_Trigger_Url_AuthN",
        "Description": "Trigger URL for the App Service Web Job must require authentication",
        "Id": "AppService150",
        "ControlSeverity": "High",
        "Automated": "No",
        "MethodName": "",
        "Rationale": "Scheduled WebJobs can be triggered by specific scheduled time or by triggered URL. WebJob triggered URL can be authenticated by AAD authentication (bearer token) or by App Services deployment credentials. Since its not recommended to use publish profiles, WebJob triggered URL must be authenticated by AAD authentication.",
        "Recommendation": "Use bearer tokens and AAD-based authentication to in the trigger.",
        "Tags": [
          "SDL",
          "Information",
          "Manual",
          "AuthZ",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_DP_Encrypt_In_Transit_Webhook",
        "Description": "The webhook used for a Web Job must encrypt sensitive data in transit",
        "Id": "AppService180",
        "ControlSeverity": "High",
        "Automated": "No",
        "MethodName": "",
        "Rationale": "Use of HTTPS ensures server/service authentication and protects data in transit from network layer man-in-the-middle, eavesdropping, session-hijacking attacks.",
        "Recommendation": "Encryption in transit in the context of webhooks can be achieved by using HTTPS URLs.",
        "Tags": [
          "SDL",
          "Information",
          "Manual",
          "DP",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_DP_Store_Secrets_in_Key_Vault",
        "Description": "All App Service secrets should be stored in Key Vault",
        "Id": "AppService190",
        "ControlSeverity": "Medium",
        "Automated": "No",
        "MethodName": "",
        "Rationale": "Keeping secrets such as DB connection strings, passwords, keys, etc. in clear text can lead to easy compromise at various avenues during an application's lifecycle. Storing them in a key vault ensures that they are protected at rest.",
        "Recommendation": "Refer https://azure.microsoft.com/en-in/documentation/articles/key-vault-get-started/ for configuring Key Vault and storing secrets.",
        "Tags": [
          "SDL",
          "Best Practice",
          "Manual",
          "DP",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_Deploy_Use_Notification_Hub",
        "Description": "App Service should use Notification Hub for push notification (instead of directly using Push Notification Service)",
        "Id": "AppService200",
        "ControlSeverity": "Medium",
        "Automated": "No",
        "MethodName": "",
        "Rationale": "Notification Hub provides a better mechanism to manage the keys related Push Notification Systems (PNS).",
        "Recommendation": "Refer https://docs.microsoft.com/en-us/azure/notification-hubs/ for details on configuring Notification Hub for push notifications.",
        "Tags": [
          "SDL",
          "Best Practice",
          "Manual",
          "Deploy",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_Config_Disable_Remote_Debugging",
        "Description": "Remote debugging must be turned off for App Service",
        "Id": "AppService210",
        "ControlSeverity": "High",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceRemoteDebuggingConfiguration",
        "Rationale": "Remote debugging requires inbound ports to be opened on App Service. These ports become easy targets for compromise from various internet based attacks.",
        "Recommendation": "Go to Azure Portal --> your App Service --> Settings --> Application Settings --> Remote Debugging --> Click on 'OFF'.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "Config",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_Config_Disable_Web_Sockets",
        "Description": "Web Sockets should be disabled for App Service",
        "Id": "AppService220",
        "ControlSeverity": "High",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceWebSocketsConfiguration",
        "Rationale": "WebSockets protocol (WS) is vulnerable to different types of security attacks. Usage of Web Sockets with in web applications has to be carefully reviewed.",
        "Recommendation": "Run command 'Set-AzWebApp -Name '<WebAppName>' -ResourceGroupName '<RGName>' -WebSocketsEnabled `$false'. Run 'Get-Help Set-AzWebApp -full' for more help. Refer: https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/HTML5_Security_Cheat_Sheet.md#websockets",
        "Tags": [
          "SDL",
          "Best Practice",
          "Automated",
          "Config",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "FixControl": {
          "FixMethodName": "DisableWebSocket",
          "FixControlImpact": "High"
        }
      },
      {
        "ControlID": "Azure_AppService_BCDR_Use_AlwaysOn",
        "Description": "'Always On' should be configured for App Service",
        "Id": "AppService230",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceAlwaysOnConfiguration",
        "Rationale": "By default, websites are unloaded if they have been idle for some period of time. However, this may not be ideal for 'high availability' requirements. Configuring 'Always On' can help prevent app services from getting timed out.",
        "Recommendation": "Go to Azure Portal --> your App Service --> Settings --> Application Settings --> Always On --> Click on 'ON'.",
        "Tags": [
          "SDL",
          "Best Practice",
          "Automated",
          "BCDR",
          "AppService",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_Deploy_Use_Latest_Version",
        "Description": "The latest version of .NET framework version should be used for App Service",
        "Id": "AppService240",
        "ControlSeverity": "Low",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceDotNetFrameworkVersion",
        "Rationale": "Running on older .Net versions could mean you are not using latest security classes. Usage of such old classes and types can make your application vulnerable.",
        "Recommendation": "Run command 'Set-AzWebApp -Name '<WebAppName>' -ResourceGroupName '<RGName>' -NetFrameworkVersion 'v4.7''. Run 'Get-Help Set-AzWebApp -full' for more help.",
        "Tags": [
          "SDL",
          "Best Practice",
          "Automated",
          "Deploy",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "FixControl": {
          "FixMethodName": "SetLatestDotNetVersion",
          "FixControlImpact": "Medium"
        }
      },
      {
        "ControlID": "Azure_AppService_Deploy_Use_ARM_Template",
        "Description": "Deployment of App Service should be done using ARM template",
        "Id": "AppService260",
        "ControlSeverity": "Medium",
        "Automated": "No",
        "MethodName": "",
        "Rationale": "Deployment using ARM template is more secure than using publish profiles. This is because the former uses user/SPN credentials which can be protected better than publish profiles and provide a better audit trail of deployment activity.",
        "Recommendation": "Use an ARM Template to ensure fully repeatable and secured configuration of a deployment. Refer https://azure.microsoft.com/en-gb/resources/templates/ to get sample quickstart templates.",
        "Tags": [
          "SDL",
          "Best Practice",
          "Manual",
          "Deploy",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_BCDR_Use_Multiple_Instances",
        "Description": "App Service must be deployed on a minimum of two instances to ensure availability",
        "Id": "AppService270",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceInstanceCount",
        "Rationale": "App Service deployed on multiple instances ensures that the App Service remains available even if an instance is down.",
        "Recommendation": "Run command 'Set-AzAppServicePlan -Name '<AppServicePlanName>' -ResourceGroupName '<RGName>' -NumberofWorkers '<NumberofInstances>''. Run 'Get-Help Set-AzAppServicePlan -full' for more help.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "BCDR",
          "AppService",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "FixControl": {
          "FixMethodName": "SetMultipleInstances",
          "FixControlImpact": "Medium"
        }
      },
      {
        "ControlID": "Azure_AppService_BCDR_Use_App_Backup",
        "Description": "Backup feature must be configured to backup data for App Service",
        "Id": "AppService280",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceBackupConfiguration",
        "Rationale": "Enabling backup on App Service ensures that there is always a previous snapshot of App Service data that can be leveraged towards recovery scenarios.",
        "Recommendation": "Run command 'Edit-AzWebAppBackupConfiguration -FrequencyInterval '1' -FrequencyUnit 'Day' -RetentionPeriodInDays '<0 or 365>' -StartTime '<TimeLessThanOrEqualToCurrentTime>' -Name '<WebAppName>' -ResourceGroupName '<RGName>' -StorageAccountUrl '<StorageAccountUrl>' -KeepAtLeastOneBackup'. Run 'Get-Help Edit-AzWebAppBackupConfiguration -full' for more help.",
        "Tags": [
          "SDL",
          "Best Practice",
          "Automated",
          "BCDR",
          "OwnerAccess",
          "AppService",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_Audit_Enable_Logging_and_Monitoring",
        "Description": "Auditing and Monitoring must be enabled for App Service",
        "Id": "AppService290",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceDiagnosticLogsConfiguration",
        "Rationale": "Auditing enables log collection of important system events pertinent to security. Regular monitoring of audit logs can help to detect any suspicious and malicious activity early and respond in a timely manner.",
        "Recommendation": "Run command 'Set-AzWebApp -Name '<WebAppName>' -ResourceGroupName '<RGName>' -DetailedErrorLoggingEnabled `$true -HttpLoggingEnabled `$true -RequestTracingEnabled `$true'. Run 'Get-Help Set-AzWebApp -full' for more help.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "Audit",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "FixControl": {
          "FixMethodName": "EnableLogging",
          "FixControlImpact": "Low"
        },
        "PolicyDefinitionGuid":"752c6934-9bcc-4749-b004-655e676ae2ac",
        "PolicyDefnResourceIdSuffix": "/config/web"
      },
      {
        "ControlID": "Azure_AppService_BCDR_Configure_Auto_Healing",
        "Description": "Auto healing should be configured for App Service",
        "Id": "AppService300",
        "ControlSeverity": "Medium",
        "Automated": "No",
        "MethodName": "",
        "Rationale": "With the use of Auto-Healing, a website can automatically recover from long running/blocked states. Auto-Healing enables automatic recycling of the worker process hosting your web application based on certain events. E.g. 1. When request count breaches a certain limit 2. When requests are running slower that expected 3. When an unexpected http status code is received X number of times 4. When the process consumes more than expected memory",
        "Recommendation": "Refer https://azure.microsoft.com/en-in/blog/auto-healing-windows-azure-web-sites/ for details on configuring auto healing.",
        "Tags": [
          "SDL",
          "Best Practice",
          "Manual",
          "BCDR",
          "AppService",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_DP_Dont_Allow_HTTP_Access",
        "Description": "App Service must only be accessible over HTTPS",
        "Id": "AppService310",
        "ControlSeverity": "High",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceHttpCertificateSSL",
        "Rationale": "Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks.",
        "Recommendation": "Run command 'Set-AzWebApp -Name '<WebAppName>' -ResourceGroupName '<RGName>' -HttpsOnly `$true. Run 'Get-Help Set-AzWebApp -full' for more help.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "DP",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "FixControl": {
          "FixMethodName": "EnableHttpsFlag",
          "FixControlImpact": "High"
        }
      },
      
      {
        "ControlID": "Azure_AppService_DP_Website_Load_Certificates_Not_All",
        "Description": "WEBSITE_LOAD_CERTIFICATES parameter must not be set to '*' (i.e. all) for App Service",
        "Id": "AppService320",
        "ControlSeverity": "High",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceLoadCertAppSettings",
        "Rationale": "Using '*' for this parameter means that all certificates will get uploaded to the VM running the website. This will most likely lead to abuse of the principle of least privilege as it is unlikely that the site needs access to all certificates at runtime.",
        "Recommendation": "Go to Azure Portal --> your App Service --> Settings --> Application Settings --> App Settings --> Check for 'WEBSITE_LOAD_CERTIFICATES' key and make sure that value is not set to '*'. Instead choose the specific certificate that is required by the App Service. Refer https://msftplayground.com/2016/11/using-certificates-azure-app-services/ for more details.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "DP",
          "AppService",
          "FunctionApp",
          "OwnerAccess",
          "Windows",
          "Linux"
        ],
        "Enabled": true
      },
 
      {
        "ControlID": "Azure_AppService_DP_Configure_Rotate_Keys_Fn",
        "Description": "Keys should be renewed after a regular interval",
        "Id": "AppService330",
        "ControlSeverity": "Medium",
        "Automated": "No",
        "MethodName": "",
        "Recommendation": "Refer https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook#authorization-keys for details on Host keys in Functions app.",
        "Tags": [
          "SDL",
          "TCP",
          "Manual",
          "DP",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "Rationale": "Periodic key/password rotation is a good security hygiene practice as, over time, it minimizes the likelihood of data loss/compromise which can arise from key theft/brute forcing/recovery attacks."
      },
      {
        "ControlID": "Azure_AppService_DP_Dont_Share_HostKeys_Fn",
        "Description": "Host key access should not be shared with individual clients",
        "Id": "AppService340",
        "ControlSeverity": "Medium",
        "Automated": "No",
        "MethodName": "",
        "Recommendation": "Refer https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook#authorization-keys for details on Host keys in Functions app.",
        "Tags": [
          "SDL",
          "TCP",
          "Manual",
          "DP",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "Rationale": "Host Keys grant full access to all the functions within a function app. Not sharing this key with individual clients ensures that clients are granted just enough permissions to invoke a particular function"
      },
      {
        "ControlID": "Azure_AppService_Authz_Use_Function_Authorization_level_Fn",
        "Description": "Authorization level for HTTP Trigger function in a function app should be set to 'Function'",
        "Id": "AppService350",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckFunctionsAuthorizationLevel",
        "Recommendation": "Go to Azure Portal --> your Functions App --> your HTTP Trigger Function --> Integrate --> Change Authorization level.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "Config",
          "AuthZ",
          "OwnerAccess",
          "FunctionApp",
          "Windows",
          "Linux"
          ],
        "Enabled": true,
        "Rationale": "Use 'Function' authorization level to ensure that users with minimum of function keys should only be able to invoke the function. This is in accordance with the principle of least privilege."
      },
 
      {
        "ControlID": "Azure_AppService_Configure_EditMode_ReadOnly_Fn",
        "Description": "Functions app edit mode should be set to Read Only",
        "Id": "AppService360",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckFunctionsEditMode",
        "Recommendation": "Go to Azure Portal --> your Functions App --> Functions app settings --> Function app edit mode --> Click on 'Read Only'.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "Config",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "Rationale": "Using 'Read Only' mode ensures that source code is changes come in via a CICD pipeline and not directly through portal. This ensures that code changes are properly audited."
      },
      {
        "ControlID": "Azure_AppService_DP_Use_Individual_FunctionKeys_Fn",
        "Description": "Different functions keys must be generated and shared with individual clients.",
        "Id": "AppService370",
        "ControlSeverity": "Medium",
        "Automated": "No",
        "MethodName": "",
        "Recommendation": "Go to Azure Portal --> your Functions App --> your Function --> Manage --> Add New Function Key.",
        "Tags": [
          "SDL",
          "TCP",
          "Manual",
          "DP",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "Rationale": "Different function keys for individual clients promotes separation of concerns. It also makes revocation easier to manage in the event of a compromise of one client."
      },
      {
        "ControlID": "Azure_AppService_DP_Restrict_CORS_Access",
        "Description": "Ensure that CORS access is granted to a limited set of trusted origins.",
        "Id": "AppService380",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceCORSAllowed",
        "Recommendation": "Go to Azure Portal --> your App Service --> API --> CORS --> Provide the specific domain names that should be allowed to make cross-origin calls. Note: No action is needed if you are not using CORS for your app.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "DP",
          "AppService",
          "FunctionApp",
          "OwnerAccess",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "Rationale": "CORS enables applications running under one domain to access a resource under another domain. Using '*' (allow all) for CORS setting means that an application running under any domain can have access to your application's resources and data. Restricting allowed origins to the specific set that needs access aligns with the principle of least privilege."
      },
      {
        "ControlID": "Azure_AppService_Configure_Important_Alerts",
        "Description": "Alerts should be configured to track unauthorized access attempts for the AppService.",
        "Id": "AppService390",
        "ControlSeverity": "Medium",
        "Automated": "No",
        "MethodName": "",
        "Recommendation": "Go to Azure Portal --> your App Service --> Monitoring --> Alerts --> Add Alert. Set alert on metrics with name 'Http 403'(unauthorized response) and 'Http 401'(forbidden response).",
        "Tags": [
          "SDL",
          "TCP",
          "Config",
          "AppService",
          "Manual",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "Rationale": "Alert rules for unauthorized requests enable you to detect any suspicious and malicious activity early enough."
      },
      {
        "ControlID": "Azure_AppService_AuthN_Use_Managed_Service_Identity",
        "Description": "Use Managed Service Identity (MSI) for accessing other AAD-protected resources from the app service.",
        "Id": "AppService400",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceMsiEnabled",
        "Recommendation": "Go to Azure Portal --> your App Service --> Settings --> Identity --> System assigned --> ON",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "Config",
          "AppService",
          "FunctionApp",
          "OwnerAccess",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "Rationale": "Managed Service Identity (MSI) allows your app to easily access other AAD-protected resources such as Azure Key Vault. The identity is managed by the Azure platform and eliminates the need to provision/manage/rotate any secrets thus reducing the overall risk. "
      },
        {
        "ControlID": "Azure_AppService_DP_Dont_Allow_HTTP_Access_Fn",
        "Description": "Function App must only be accessible over HTTPS",
        "Id": "AppService410",
        "ControlSeverity": "High",
        "Automated": "Yes",
        "MethodName": "CheckFunctionsAppHttpCertificateSSL",
        "Rationale": "Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks.",
        "Recommendation": "Run command 'Set-AzResource -ResourceName '<WebAppName>' -ResourceGroupName '<RGName>' -ResourceType 'Microsoft.Web/sites' -Properties @{httpsOnly='true'} -Force '. Run 'Get-Help Set-AzResource -full' for more help. Note:'HttpsOnly' is required only for 'Http Trigger' functions.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "DP",
          "OwnerAccess",
          "FunctionApp",
          "Windows"
        ],
       "Enabled": true
      },
      {
        "ControlID": "Azure_AppService_DP_Use_Approved_TLS_Version",
        "Description": "Use approved version of TLS for the App Service",
        "Id": "AppService420",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceTLSVersion",
        "Recommendation": "Go to Azure Portal --> your App Service --> Settings --> TLS/SSL --> Minimum TLS version --> set to org approved version (see detailed logs).",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "DP",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "Rationale": "TLS provides privacy and data integrity between client and server. Using approved TLS version significantly reduces risks from security design issues and security bugs that may be present in older versions."
      },
      {
        "ControlID": "Azure_AppService_DP_Verify_Installed_Extensions",
        "Description": "Extensions installed on a App Service should be carefully reviewed",
        "Id": "AppService430",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceInstalledExtensions",
        "Recommendation": "Go to Azure Portal --> your App Service --> Development Tools --> Extensions --> Verify installed extensions.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "DP",
          "AppService",
          "FunctionApp",
          "Windows"
        ],
        "Enabled": true,
        "Rationale": "Each extension is something like a plugin that adds functionality to your App Service. Installing unknown/unverified extensions can be dangerous as some third party extensions may have vulnerabilities which introduce unnecessary avenues for attack."
      },
      {
        "ControlID": "Azure_AppService_AuthZ_Configure_IP_Restrictions",
        "Description": "Setup IP-based access restrictions for App Service if feasible",
        "Id": "AppService440",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceAccessRestriction" ,
        "Recommendation": "Consider using IP-based access restrictions for App Service if feasible. Steps: Go to Azure Portal --> your App Service --> Networking --> Access Restrictions --> Configure Access Restrictions --> Add/Verify access restriction rule for app and scm site. For more information, refer: https://docs.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "DP",
          "AppService",
          "FunctionApp",
          "Windows",
          "Linux"
        ],
        "Enabled": true,
        "Rationale": "Using the IP/VNet subnet rules based access restriction ensures that access to the data or the service is restricted to a specific set of IPs. NOTE: While this control does provide an extra layer of access control protection, it may not always be feasible to implement in all scenarios."
      },
      {
        "ControlID": "Azure_AppService_DP_Review_CORS_Request_Credential",
        "Description": "Review use of credentials in CORS request for App Service",
        "Id": "AppService450",
        "ControlSeverity": "Medium",
        "Automated": "Yes",
        "MethodName": "CheckAppServiceCORSCredential",
        "Recommendation": "Go to Azure Portal --> your App Service --> API --> CORS --> Request Credentials --> Review if you need to enable 'Access-Control-Allow-Credentials'. Note: No action is needed if you are not using CORS for your app.",
        "Tags": [
          "SDL",
          "TCP",
          "Automated",
          "DP",
          "AppService",
          "FunctionApp",
          "Windows"
        ],
        "Enabled": true,
        "Rationale": "CORS enables applications running under one domain to access a resource under another domain. Allowing cross-origin credentials is a security risk. A website at another domain can send a signed-in user's credentials to the app on the user's behalf without the user's knowledge."
      }
      
    ]
}