Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostic Settings for App Service & Function App #136

Merged
merged 3 commits into from
Jan 12, 2022

Conversation

SenthuranSivananthan
Copy link
Contributor

@SenthuranSivananthan SenthuranSivananthan commented Jan 12, 2022

Overview/Summary

App Service & Function App can be deployed in various scenarios such as Windows, Linux and in containers. Each scenario is represented as kind property and therefore each needs to be support for Diagnostic Setting policies.

The approach taken is to expand the existing policy definitions to include additional kinds. The scenarios now supported:

Kinds for App Service deployments

  • app (Windows)
  • app,linux (Linux)
  • app,linux,container (Linux + Container)

Kinds for Function App deployments

  • functionapp (Windows)
  • functionapp,linux (Linux)
  • functionapp,linux,container (Linux + Container)

This is made possible because there are no configuration change between the kinds in each type of deployment. It was verified by:

  1. Deploying each type of scenario
  2. Execute Policy Generation Script
  3. Diff between the scenarios to verify

App Service

# Comparing Windows & Linux App Service
diff Apply-Diag-Settings-LA-Microsoft.Web-sites-app/azurepolicy.rules.json Apply-Diag-Settings-LA-Microsoft.Web-sites-app-linux/azurepolicy.rules.json
14c14
<         "equals": "app"
---
>         "equals": "app,linux"


# Comparing Windows & Linux + Container App Service
diff Apply-Diag-Settings-LA-Microsoft.Web-sites-app/azurepolicy.rules.json Apply-Diag-Settings-LA-Microsoft.Web-sites-app-linux-container/azurepolicy.rules.json
14c14
<         "equals": "app"
---
>         "equals": "app,linux,container"

Function App

# Comparing Windows & Linux Function App
diff Apply-Diag-Settings-LA-Microsoft.Web-sites-functionapp/azurepolicy.rules.json Apply-Diag-Settings-LA-Microsoft.Web-sites-functionapp-linux/azurepolicy.rules.json
14c14
<         "equals": "functionapp"
---
>         "equals": "functionapp,linux"

# Comparing Windows & Linux + Container Function App
diff Apply-Diag-Settings-LA-Microsoft.Web-sites-functionapp/azurepolicy.rules.json Apply-Diag-Settings-LA-Microsoft.Web-sites-functionapp-linux-container/azurepolicy.rules.json
14c14
<         "equals": "functionapp"
---
>         "equals": "functionapp,linux,container"

This PR fixes/adds/changes/removes

Expands on #133 to support additional scenarios.

Fixes #132

Breaking Changes

None

Testing Evidence

Ensure policies are updated with the revised rules:

image
image

Ensure policy evaluation identifies resources that requires diagnostic settings across each scenario:

To manually trigger a policy scan

az policy state trigger-scan --subscription <<SUB_ID>>

image
image

Remediate non-compliant resources

image

image

Verify diagnostic settings turned on

image
image
image

As part of this Pull Request I have

  • Checked for duplicate Pull Requests
  • Associated it with relevant GitHub Issues
  • Ensured my code/branch is up-to-date with the latest changes in the main branch
  • Performed testing and provided evidence.
  • Updated relevant and associated documentation.

@SenthuranSivananthan SenthuranSivananthan marked this pull request as ready for review January 12, 2022 19:00
@hudua
Copy link
Contributor

hudua commented Jan 12, 2022

Looks good!

@hudua hudua merged commit bfbd761 into Azure:main Jan 12, 2022
@SenthuranSivananthan SenthuranSivananthan deleted the webAppFuncDiagPolicy branch January 12, 2022 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Diagnostic Settings at scale for Azure Web App & Functions
2 participants