Support SqlPackage Access Token Authentication
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- azure, github-actions, sql, typescript
Research direction
Start by tracing the action's connection-string validation and argument handling, then reproduce the workflow using the shown connection string and /at token argument. Compare its behavior with the direct sqlpackage command. Done means the action can deploy with SqlPackage access-token authentication when no Authentication, User, or User Id value is present.
Written by the indexing model from the issue text.
Description
SqlPackage supports the passing in of an access token as an authentication method, with no Authentication key/value pair present in the connection string. When this key is omitted from the action, an error is returned requiring that User or User Id keys are provided. Below is the example workflow yaml:
- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Get Access Token
run: |
ACCESS_TOKEN=$(az account get-access-token \
--resource https://database.windows.net/ \
--query accessToken \
--output tsv)
echo "AZ_ACCESS_TOKEN=$ACCESS_TOKEN" >> "$GITHUB_ENV"
- name: build
run: # build db project
- name: Deploy to Azure SQL Database
uses: Azure/sql-action@v2.3
with:
connection-string: 'Server=<server>;Initial Catalog=<database>;Connection timeout=60;Encrypt=True'
path: # dacpac file
action: 'publish'
skip-firewall-check: true
arguments: /at:$AZ_ACCESS_TOKEN
The above fails with the error: Invalid connection string. Please ensure 'User' or 'User ID' is provided in the connection string.
Replacing the final deployment step with a direct call to sqlpackage and passing in the same arguments successfully deploys the dacpac, like so:
sqlpackage /Action:Publish /TargetConnectionString:"Server=<server>;Initial Catalog=<database>;Connection timeout=60;Encrypt=True;" /SourceFile:<dacpac> /at:$AZ_ACCESS_TOKEN
The use case for this is that I am deploying to an Azure SQL instance using a user assigned managed identity with federated credentials, running on a self hosted runner which has not been assigned the managed identity. Using Authentication=Active Directory Managed Identity requires that the MI has been assigned to the runner machine.
- Dominant language
- TypeScript
- Stars
- 142
- Forks
- 73
- Avg merge
- 9d 18h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/sql-action
-
need-to-triage
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Azure/sql-action#247 ·
-
need-to-triage
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Azure/sql-action#282 ·
-
bug
Azure/sql-action#267 · 1 assignee ·
-
need-to-triage
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Azure/sql-action#261 ·
-
need-to-triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Azure/sql-action#256 · 1 comment ·
All issues in Azure/sql-action
Similar issues
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agilepathway/label-checker#640 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
agentic-workflows
Difficulty 1/5 Under an hour Newbie friendliness 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/models.dev#7701 ·