如何更換Azure SQL DB blob storage credentials

BetaRabbit發表於2022-02-16

通過Azure Data Studio等工具登入到目標DB,執行以下SQL刪除當前的credentials。

DROP EXTERNAL DATA SOURCE BlobStorageDataSource;

DROP DATABASE SCOPED CREDENTIAL BlobAccessCredential;

執行以下SQL建立一個新的credentials(將Placeholder替換為真實環境的值)。

  • PLACEHOLDER_BLOB_SHARED_ACCESS_SIGNATURE: storage SAS token
  • PLACEHOLDER_BLOB_NAME: storage name
CREATE DATABASE SCOPED CREDENTIAL BlobAccessCredential
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = 'PLACEHOLDER_BLOB_SHARED_ACCESS_SIGNATURE';
 
CREATE EXTERNAL DATA SOURCE BlobStorageDataSource
WITH (TYPE = BLOB_STORAGE,
    LOCATION = 'https://PLACEHOLDER_BLOB_NAME.blob.core.windows.net',
    CREDENTIAL= BlobAccessCredential);

相關文章