CodeQL default setup for GitHub Advanced Security in Azure DevOps is currently in preview and is still rolling out, and the behavior described matches a backend limitation/bug rather than a configuration issue.
From the documented behavior:
- CodeQL default setup is a managed, organization-level feature that runs using Azure Pipelines and is configured centrally for agent pool and schedule at Organization settings → Repositories → CodeQL default setup configurable options.
- Default setup is designed to be the quickest way to enable code scanning and runs on a weekly schedule, surfacing results in the Advanced Security tab.
- The feature has been in private preview and then public preview, and Microsoft has explicitly called out rollout issues and delays:
- CodeQL default setup (one‑click enablement) was initially in private preview.
- Later release notes state that the rollout of CodeQL default setup has been delayed due to issues discovered during rollout, and the team is working to resolve them.
Given this:
- The organization-level configuration (agent pool, schedule, enable for new projects/repos) working, while repo-level toggling for existing repos does not persist, is consistent with an incomplete or problematic rollout of the default setup feature.
- The fact that
advSecEnablementLastChangedDateupdates butcodeQLEnabledremainsnull, despite a 204 response, indicates that the server is accepting the request but not committing the CodeQL default setup state for that repo. This aligns with the known rollout issues mentioned in the release notes. - Other Advanced Security features (secret scanning, dependency scanning, manual CodeQL runs via “View Details”) working confirms that Advanced Security itself is enabled and that the problem is specific to CodeQL default setup persistence.
Workable paths based on the documented options:
- Use Advanced setup for CodeQL in affected repos
- Configure CodeQL via pipelines using the Advanced Security CodeQL tasks (
AdvancedSecurity-CodeQL-Init@1andAdvancedSecurity-Codeql-Analyze@1) as described under advanced setup. This gives full control and does not depend on the default setup toggle. - Note that the CodeQL autobuild task is deprecated; use
buildtype: noneinAdvancedSecurity-CodeQL-Init@1instead.
- Configure CodeQL via pipelines using the Advanced Security CodeQL tasks (
- Continue using default setup only where it persists (e.g., new repos)
- Since default setup is recommended as the starting point and is centrally configured, allow it to manage new repositories where the toggle is applied automatically from org/project settings.
- Treat the non‑persisting toggle as a product issue
- Because Microsoft has acknowledged rollout issues and even delayed the rollout of CodeQL default setup, the non‑persisting
codeQLEnabledflag for existing repos is best handled as a service-side bug rather than further client-side troubleshooting. - For production needs, rely on advanced setup until the rollout issues are resolved and default setup is fully supported for existing repositories.
- Because Microsoft has acknowledged rollout issues and even delayed the rollout of CodeQL default setup, the non‑persisting
In short, the behavior is a limitation/bug in the current preview rollout of CodeQL default setup. Use advanced setup for existing repos that need reliable CodeQL scanning, and rely on default setup only where it is automatically and correctly applied.
References:
- CodeQL default setup public preview and enhanced work item experiences
- Configure GitHub Advanced Security for Azure DevOps (bundled-ghazdo)
- Configure GitHub Advanced Security for Azure DevOps (standalone-ghazdo)
- Set up code scanning
- CodeQL default setup (one-click enablement)
- Streamlined Test Plans with Improved Visibility and Faster Execution