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

[Modules] Add all objects under Web/Sites/config #3556

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

HenrikVestli
Copy link

Description

Instead of creating one folder and with sub items per sites/config properties, I suggest using an array to pass the objects to sites/config with an foreach loop. Sites/config currently have the following properties that’s not supported by this repo

  • authsettings
  • azurestorageaccounts
  • backup
  • connectionstrings
  • logs
  • metadata
  • pushsettings
  • slotConfigNames
  • web

With this approach you can pass the config as array with the properties under sites/config that you need.

config: [
  {
    name: 'web'
    value: {
      ipSecurityRestrictions: [
        {
          vnetSubnetResourceId: nestedDependencies.outputs.subnetResourceId
          action: 'Allow'
          tag: 'Default'
          priority: 200
          name: 'Allow from VNET'
          description: 'Allow from vnet'
        }
        {
          ipAddress: 'Any'
          action: 'Deny'
          priority: 2147483647
          name: 'Deny all'
          description: 'Deny all access'
        }
      ]
      ipSecurityRestrictionsDefaultAction: 'Deny'
    }
  }
  {
    name: 'authsettingsV2'
    value: {
      globalValidation: {
        requireAuthentication: true
        unauthenticatedClientAction: 'Return401'
      }
      httpSettings: {
        forwardProxy: {
          convention: 'NoProxy'
        }
        requireHttps: true
        routes: {
          apiPrefix: '/.auth'
        }
      }
      identityProviders: {
        azureActiveDirectory: {
          enabled: true
          login: {
            disableWWWAuthenticate: false
          }
          registration: {
            clientId: 'd874dd2f-2032-4db1-a053-f0ec243685aa'
            clientSecretSettingName: 'EASYAUTH_SECRET'
            openIdIssuer: 'https://sts.windows.net/${tenant().tenantId}/v2.0/'
          }
          validation: {
            allowedAudiences: [
              'api://d874dd2f-2032-4db1-a053-f0ec243685aa'
            ]
            defaultAuthorizationPolicy: {
              allowedPrincipals: {}
            }
            jwtClaimChecks: {}
          }
        }
      }
      login: {
        allowedExternalRedirectUrls: [
          'string'
        ]
        cookieExpiration: {
          convention: 'FixedTime'
          timeToExpiration: '08:00:00'
        }
        nonce: {
          nonceExpirationInterval: '00:05:00'
          validateNonce: true
        }
        preserveUrlFragmentsForLogins: false
        routes: {}
        tokenStore: {
          azureBlobStorage: {}
          enabled: true
          fileSystem: {}
          tokenRefreshExtensionHours: 72
        }
      }
      platform: {
        enabled: true
        runtimeVersion: '~1'
      }
    }
  }
]

More info on the different properties can be found here Microsoft.Web/sites/config 'web' - Bicep, ARM template & Terraform AzAPI reference | Microsoft Learn

Changes done
• Renamed config--authsettingsv2 (folder) to config (under root and slots)
• Changed config/main.bicep to handle input on name and properties.
• Changed main.bicep to for each loop with config as an array.
• Changes main.test.bicep to use new settings.

Pipeline references

Pipeline
Web - Sites

Type of Change

Please delete options that are not relevant.

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Update to documentation

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • My corresponding pipelines / checks run clean and green without any errors or warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (readme)
  • I did format my code

@HenrikVestli HenrikVestli requested a review from a team as a code owner August 9, 2023 16:15
@HenrikVestli
Copy link
Author

HenrikVestli commented Aug 9, 2023 via email

@AlexanderSehr
Copy link
Contributor

AlexanderSehr commented Aug 9, 2023

Hey @HenrikVestli,
it has been a long time since this was implemented and I try to wrap my head around it (& maybe @dr-dolittle has some intput too).
I believe the original reason this was split was to be able to implement some logic as is the case in the AppSettings child module and its appInsightsValues variable.
In contrast, the V2 child is very generic and nobody ever contributed the other types of configs you listed above.
I guess, as long as there is no need to implement any of the other config types explicitely (because they'd also auto-create some app settings) nothing speaks against replacing authsettingsv2 in favor of plain config.

I'm unfortuantely not an AppService expert, so I may not be the best person to advise here - just raising what I recall.

cc: @eriqua, any thoughts?

@AlexanderSehr AlexanderSehr added enhancement New feature or request [cat] modules category: modules labels Aug 10, 2023
@HenrikVestli
Copy link
Author

@AlexanderSehr or @eriqua : Any thoughts or updates on this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[cat] modules category: modules enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants