Skip to content

Commit

Permalink
stage app service auditor...one day
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrau1 committed Jun 19, 2024
1 parent 5defc68 commit a22a87c
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions eeauditor/auditors/azure/Azure_AppServices_Auditor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from azure.mgmt.web import WebSiteManagementClient, models
import datetime
import base64
import json
from check_register import CheckRegister

registry = CheckRegister()

def get_all_app_services_apps(cache: dict, azureCredential, azSubId: str) -> list[models.Site]:
"""
Returns a list of all Azure Database for MySQL Servers in a Subscription
"""
azAppServicesClient = WebSiteManagementClient(azureCredential, azSubId)

response = cache.get("get_all_app_services_apps")
if response:
return response

appServicesList = [serv for serv in azAppServicesClient.web_apps.list()]
if not appServicesList or appServicesList is None:
appServicesList = []

cache["get_all_app_services_apps"] = appServicesList
return cache["get_all_app_services_apps"]

'''
@registry.register_check("azure.application_services")
def azure_app_services_service_authentication_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str, azureCredential, azSubId: str) -> dict:
"""
[Azure.AppServices.1] Azure App Services web applications should use Azure App Service Authentication
"""
azAppServicesClient = WebSiteManagementClient(azureCredential, azSubId)
# ISO Time
iso8601Time = datetime.datetime.now(datetime.timezone.utc).isoformat()
for webapp in get_all_app_services_apps(cache, azureCredential, azSubId):
# B64 encode all of the details for the Asset
assetJson = json.dumps(webapp.as_dict(),default=str).encode("utf-8")
assetB64 = base64.b64encode(assetJson)
appServicesWebAppName = webapp.name
appServicesWebAppId = str(webapp.id)
azRegion = webapp.location
rgName = appServicesWebAppId.split("/")[4]
print(webapp.as_dict())
'''

0 comments on commit a22a87c

Please sign in to comment.