Repository navigation
Use a least-privilege SQL identity for the app - #73
Open
mageroni with github-agentic-autofix[bot] wants to merge 2 commits into
Open
mageroni with github-agentic-autofix[bot] wants to merge 2 commits into
mageroni with github-agentic-autofix[bot] wants to merge 2 commits into
Conversation
Co-authored-by: mageroni <107436170+mageroni@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The README’s SQL provisioning guidance leaves excessive permissions on the runtime identity and omits application-user setup and database-access instructions needed across both deployment paths.
2 open issues
What changed in this PR
This PR separates the Bicep-deployed app’s Azure SQL credentials from the server administrator account, reducing the app’s database privileges.
Changes:
- Adds a secure application-password parameter and switches the connection string to
copilotSurveyApp. - Documents manual user provisioning and permissions for table creation and survey reads/writes.
| File | Description |
|---|---|
| README.md | Documents the contained database user and required permissions. |
| deployment/template.bicep | Adds separate application credentials and replaces administrator credentials in the app connection string. |
Review effort: Max (auto)
|
|
||
| You can use this link to deploy all resources automatically in your Azure subscription [](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fmageroni%2Fcopilot-survey-engine%2Fmain%2Fdeployment%2Ftemplate.json) | ||
|
|
||
| For deployments using `deployment/template.bicep`, configure the app's SQL credentials separately from the SQL server administrator credentials. Before starting the app, create a contained database user named `copilotSurveyApp` in the `copilotUsage` database using the password supplied as `sqlApplicationLoginPassword`. Grant that user only the permissions needed by the app: |
| GRANT SELECT, INSERT, UPDATE ON SCHEMA::dbo TO [copilotSurveyApp]; | ||
| ``` | ||
|
|
||
| The app creates `SurveyResults` on first use and then reads and writes survey responses. Do not use the SQL server administrator credentials for the app connection. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The app’s database connection used the SQL server administrator login, giving a compromised app broader privileges than needed.
Deployment: Use the contained
copilotSurveyAppdatabase user and a separate securesqlApplicationLoginPasswordparameter.Provisioning: Document the minimum database permissions required by the app: