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

Create shared access signature RPC #18823

Merged
merged 20 commits into from
Apr 21, 2022

Conversation

nemanja-milovancevic
Copy link
Contributor

I added the createSas method to the backup provider. It's needed for creating a shared access signature for the backup/restore blob container.

This method should be used when the user wants to back up the database to the URL or restore it from the URL. A shared access signature is an expiring secret string that can be used to store something on a blob container. After creating SAS, it should be stored in the MSSQL sys.credential table. Method createSas does these two things: it creates SAS and stores it in sys.credentials.

The parameters are:

  • ownerUri: SQL connection string, needed for storing SAS on the MSSQL
  • blobContainerUri: URI of the blob container for which the method creates SAS (format: https://myaccount.blob.core.windows.net/mycontainer)
  • blobContainerKey: blob container key needed for creating SAS for the blob
  • storageAccountName: name of the storage account. It could be parsed from blob container URI, but I found it easier to pass it as a separate parameter.

You can see the flow here:
backup restore url drawio

From the UI point of view, this is the RPC that's going to be called when the user clicks Create Credentials button on the URL browser dialog:
image

@nemanja-milovancevic nemanja-milovancevic changed the title Create sas Create shared access signature RPC Mar 25, 2022
extensions/mssql/src/mssql.d.ts Outdated Show resolved Hide resolved
extensions/mssql/src/mssql.d.ts Outdated Show resolved Hide resolved
extensions/mssql/src/contracts.ts Outdated Show resolved Hide resolved
src/sql/azdata.d.ts Outdated Show resolved Hide resolved
src/sql/workbench/api/common/sqlExtHostTypes.ts Outdated Show resolved Hide resolved
src/sql/workbench/api/common/extHostDataProtocol.ts Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Mar 31, 2022

Pull Request Test Coverage Report for Build 2202984950

  • 1 of 2 (50.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0002%) to 42.198%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/sql/workbench/api/common/sqlExtHost.protocol.ts 1 2 50.0%
Totals Coverage Status
Change from base Build 2199087301: 0.0002%
Covered Lines: 27753
Relevant Lines: 61529

💛 - Coveralls

extensions/mssql/src/mssql.d.ts Outdated Show resolved Hide resolved
src/sql/azdata.d.ts Outdated Show resolved Hide resolved
src/sql/workbench/services/blob/browser/blobService.ts Outdated Show resolved Hide resolved
src/sql/workbench/services/blob/browser/blobService.ts Outdated Show resolved Hide resolved
src/sql/workbench/services/blob/browser/blobService.ts Outdated Show resolved Hide resolved
@Charles-Gagnon
Copy link
Contributor

Alright, everything here looks good but let's finish up the STS PR and get that in so that we can also update STS in this PR (since this depends on the STS changes to function)

@Charles-Gagnon Charles-Gagnon requested a review from caohai April 21, 2022 15:50
@Charles-Gagnon
Copy link
Contributor

@caohai FYI, this is bringing in microsoft/sqltoolsservice#1467

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.

5 participants