From 120ed166afd43e19ac6e96509e6158736d9119e3 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Tue, 13 Oct 2020 16:14:01 +0800 Subject: [PATCH] [storage][stg74] test coverage improvement (#11757) * use preview for blob and use defaultCredential in datalake * use preview subscription for datalake * turn on log * throw when accountName is invalid * CONTAINER_SOFT_DELETE_ * set cors in service properties * PREMIUM_FILE_ * blob remove .only * SOFT_DELETE_ for both blob and share * unskip a tag case * unskip all f,t cases in browser * file use production subscription * add role for datalakeAccount * me * undo datalake roleAssignment * unskip blob delegation SAS cases via using DefaultCredential * add blobDataOwnerRoleId * premiumFileAccountName * me * unskip last access tracking case * me * delegation sas refactor * fix CI * getRangeListDiff .only * run all cases in file * skip getRangeListDiff in live tests * rename and add comments * last access * skip LAT * me --- sdk/storage/storage-blob/karma.conf.js | 4 +- .../recording_lastaccessed_returned.js | 196 ++++++++++ ...sas_should_work_for_blob_version_delete.js | 200 +++++++++++ sdk/storage/storage-blob/sample.env | 8 +- .../src/BlobSASSignatureValues.ts | 267 +++++++++----- .../storage-blob/test/blobclient.spec.ts | 46 +-- .../test/blobserviceclient.spec.ts | 10 +- .../storage-blob/test/blobversioning.spec.ts | 30 -- .../storage-blob/test/node/sas.spec.ts | 37 +- sdk/storage/storage-blob/test/utils/index.ts | 20 ++ .../test/utils/testutils.common.ts | 8 +- sdk/storage/storage-blob/tests.yml | 3 +- ...ory_should_work_for_permissions_m_e_o_p.js | 115 +++--- ...gentobjectid_preauthorizedagentobjectid.js | 133 ++++--- ...ationsas_should_work_with_correlationid.js | 99 ++++-- ...ile_should_work_for_permissions_m_e_o_p.js | 98 +++-- ...onsas_should_work_for_file_for_20191212.js | 168 +++++++++ .../src/sas/DataLakeSASSignatureValues.ts | 164 +++++++-- .../test/node/sas.spec.ts | 115 ++++-- .../storage-file-datalake/test/utils/index.ts | 5 +- sdk/storage/storage-file-datalake/tests.yml | 1 + .../test/fileclient.spec.ts | 21 +- .../test/fileserviceclient.spec.ts | 8 +- sdk/storage/storage-file-share/tests.yml | 2 + sdk/storage/storage-queue/tests.yml | 2 + sdk/storage/test-resources-post.ps1 | 6 + sdk/storage/test-resources.json | 335 ++++++++++++------ 27 files changed, 1590 insertions(+), 511 deletions(-) create mode 100644 sdk/storage/storage-blob/recordings/node/blobclient/recording_lastaccessed_returned.js create mode 100644 sdk/storage/storage-blob/recordings/node/shared_access_signature_sas_generation_nodejs_only/recording_generateuserdelegationsas_should_work_for_blob_version_delete.js create mode 100644 sdk/storage/storage-file-datalake/recordings/node/shared_access_signature_sas_generation_nodejs_only/recording_generateuserdelegationsas_should_work_for_file_for_20191212.js diff --git a/sdk/storage/storage-blob/karma.conf.js b/sdk/storage/storage-blob/karma.conf.js index 18e2277dceb2..0c0125680a59 100644 --- a/sdk/storage/storage-blob/karma.conf.js +++ b/sdk/storage/storage-blob/karma.conf.js @@ -68,8 +68,8 @@ module.exports = function(config) { "ENCRYPTION_SCOPE_2", "ORS_DEST_ACCOUNT_NAME", "ORS_DEST_ACCOUNT_SAS", - "CONTAINER_SOFT_DELETE_ACCOUNT_NAME", - "CONTAINER_SOFT_DELETE_ACCOUNT_SAS" + "SOFT_DELETE_ACCOUNT_NAME", + "SOFT_DELETE_ACCOUNT_SAS" ], // test results reporter to use diff --git a/sdk/storage/storage-blob/recordings/node/blobclient/recording_lastaccessed_returned.js b/sdk/storage/storage-blob/recordings/node/blobclient/recording_lastaccessed_returned.js new file mode 100644 index 000000000000..44894d8c8d9e --- /dev/null +++ b/sdk/storage/storage-blob/recordings/node/blobclient/recording_lastaccessed_returned.js @@ -0,0 +1,196 @@ +let nock = require('nock'); + +module.exports.hash = "554a9260d6af406d03e8b94e399b0b50"; + +module.exports.testInfo = {"uniqueName":{"container":"container160248070036307761","blob":"blob160248070171605025"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container160248070036307761') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 12 Oct 2020 05:31:41 GMT', + 'ETag', + '"0x8D86E70197A483F"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '6be4576a-901e-0016-5558-a03c66000000', + 'x-ms-client-request-id', + '70237b34-ae1c-4f71-a825-fbe844fe537a', + 'x-ms-version', + '2020-02-10', + 'Date', + 'Mon, 12 Oct 2020 05:31:41 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container160248070036307761/blob160248070171605025', "Hello World") + .reply(201, "", [ + 'Content-Length', + '0', + 'Content-MD5', + 'sQqNsWTgdUEFt6mb5y4/5Q==', + 'Last-Modified', + 'Mon, 12 Oct 2020 05:31:41 GMT', + 'ETag', + '"0x8D86E7019AAC2FD"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '6be45779-901e-0016-5958-a03c66000000', + 'x-ms-client-request-id', + '68e00b27-3a66-40cf-ad47-5447a9d90c7e', + 'x-ms-version', + '2020-02-10', + 'x-ms-content-crc64', + 'YeJLfssylmU=', + 'x-ms-request-server-encrypted', + 'true', + 'x-ms-version-id', + '2020-10-12T05:31:41.8939133Z', + 'Date', + 'Mon, 12 Oct 2020 05:31:41 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .get('/container160248070036307761/blob160248070171605025') + .reply(200, "Hello World", [ + 'Content-Length', + '11', + 'Content-Type', + 'application/octet-stream', + 'Content-MD5', + 'sQqNsWTgdUEFt6mb5y4/5Q==', + 'Last-Modified', + 'Mon, 12 Oct 2020 05:31:41 GMT', + 'Accept-Ranges', + 'bytes', + 'ETag', + '"0x8D86E7019AAC2FD"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '6be45781-901e-0016-6058-a03c66000000', + 'x-ms-client-request-id', + '4eea2cca-8a7f-4734-a27e-667b7fc3e456', + 'x-ms-version', + '2020-02-10', + 'x-ms-version-id', + '2020-10-12T05:31:41.8939133Z', + 'x-ms-is-current-version', + 'true', + 'x-ms-creation-time', + 'Mon, 12 Oct 2020 05:31:41 GMT', + 'x-ms-lease-status', + 'unlocked', + 'x-ms-lease-state', + 'available', + 'x-ms-blob-type', + 'BlockBlob', + 'x-ms-server-encrypted', + 'true', + 'x-ms-last-access-time', + 'Mon, 12 Oct 2020 05:31:41 GMT', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,x-ms-version-id,x-ms-is-current-version,Content-Type,Last-Modified,ETag,x-ms-creation-time,Content-MD5,x-ms-lease-status,x-ms-lease-state,x-ms-blob-type,x-ms-server-encrypted,Accept-Ranges,x-ms-last-access-time,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 12 Oct 2020 05:31:42 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .head('/container160248070036307761/blob160248070171605025') + .reply(200, "", [ + 'Content-Length', + '11', + 'Content-Type', + 'application/octet-stream', + 'Content-MD5', + 'sQqNsWTgdUEFt6mb5y4/5Q==', + 'Last-Modified', + 'Mon, 12 Oct 2020 05:31:41 GMT', + 'Accept-Ranges', + 'bytes', + 'ETag', + '"0x8D86E7019AAC2FD"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '6be45789-901e-0016-6658-a03c66000000', + 'x-ms-client-request-id', + 'cc753c9e-80ce-4212-bbaa-aec051ec1cb9', + 'x-ms-version', + '2020-02-10', + 'x-ms-version-id', + '2020-10-12T05:31:41.8939133Z', + 'x-ms-is-current-version', + 'true', + 'x-ms-creation-time', + 'Mon, 12 Oct 2020 05:31:41 GMT', + 'x-ms-lease-status', + 'unlocked', + 'x-ms-lease-state', + 'available', + 'x-ms-blob-type', + 'BlockBlob', + 'x-ms-server-encrypted', + 'true', + 'x-ms-access-tier', + 'Hot', + 'x-ms-access-tier-inferred', + 'true', + 'x-ms-last-access-time', + 'Mon, 12 Oct 2020 05:31:42 GMT', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,x-ms-version-id,x-ms-is-current-version,Content-Type,Last-Modified,ETag,x-ms-creation-time,Content-MD5,x-ms-lease-status,x-ms-lease-state,x-ms-blob-type,x-ms-server-encrypted,x-ms-access-tier,x-ms-access-tier-inferred,Accept-Ranges,x-ms-last-access-time,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 12 Oct 2020 05:31:42 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .get('/container160248070036307761') + .query(true) + .reply(200, "blob160248070171605025blob1602480701716050252020-10-12T05:31:41.8939133ZtrueMon, 12 Oct 2020 05:31:41 GMTMon, 12 Oct 2020 05:31:41 GMT0x8D86E7019AAC2FD11application/octet-streamsQqNsWTgdUEFt6mb5y4/5Q==Mon, 12 Oct 2020 05:31:42 GMTBlockBlobHottrueunlockedavailabletrue", [ + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '6be45792-901e-0016-6d58-a03c66000000', + 'x-ms-client-request-id', + 'e6f76fa9-fe57-4fb5-a12f-c7f0cfdde992', + 'x-ms-version', + '2020-02-10', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,Content-Type,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 12 Oct 2020 05:31:42 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container160248070036307761') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '6be4579b-901e-0016-7458-a03c66000000', + 'x-ms-client-request-id', + '834ad9e6-c56f-4681-8c2a-6876d8fd5a82', + 'x-ms-version', + '2020-02-10', + 'Date', + 'Mon, 12 Oct 2020 05:31:43 GMT' +]); diff --git a/sdk/storage/storage-blob/recordings/node/shared_access_signature_sas_generation_nodejs_only/recording_generateuserdelegationsas_should_work_for_blob_version_delete.js b/sdk/storage/storage-blob/recordings/node/shared_access_signature_sas_generation_nodejs_only/recording_generateuserdelegationsas_should_work_for_blob_version_delete.js new file mode 100644 index 000000000000..d26a2cb492a1 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/node/shared_access_signature_sas_generation_nodejs_only/recording_generateuserdelegationsas_should_work_for_blob_version_delete.js @@ -0,0 +1,200 @@ +let nock = require('nock'); + +module.exports.hash = "7872ae4b23bd43f1c023ca7f23cf932b"; + +module.exports.testInfo = {"uniqueName":{"container":"container160241543590404390","blob":"blob160241543734202002"},"newDate":{"now":"2020-10-11T11:23:58.046Z","tmr":"2020-10-11T11:23:58.049Z"}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container160241543590404390') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Sun, 11 Oct 2020 11:23:57 GMT', + 'ETag', + '"0x8D86DD824D7F69E"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '32151e83-501e-0054-7ac1-9f85e6000000', + 'x-ms-client-request-id', + '18d69adc-e637-45ab-ab53-ecce0a236d25', + 'x-ms-version', + '2020-02-10', + 'Date', + 'Sun, 11 Oct 2020 11:23:56 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container160241543590404390/blob160241543734202002', "Hello World") + .reply(201, "", [ + 'Content-Length', + '0', + 'Content-MD5', + 'sQqNsWTgdUEFt6mb5y4/5Q==', + 'Last-Modified', + 'Sun, 11 Oct 2020 11:23:57 GMT', + 'ETag', + '"0x8D86DD82512C0E5"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '32151e97-501e-0054-08c1-9f85e6000000', + 'x-ms-client-request-id', + '5095f632-3165-4c58-9ba9-efde4f13f72d', + 'x-ms-version', + '2020-02-10', + 'x-ms-content-crc64', + 'YeJLfssylmU=', + 'x-ms-request-server-encrypted', + 'true', + 'x-ms-version-id', + '2020-10-11T11:23:57.5274725Z', + 'Date', + 'Sun, 11 Oct 2020 11:23:57 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container160241543590404390/blob160241543734202002') + .reply(201, "", [ + 'Content-Length', + '0', + 'Content-MD5', + '1B2M2Y8AsgTpgAmY7PhCfg==', + 'Last-Modified', + 'Sun, 11 Oct 2020 11:23:57 GMT', + 'ETag', + '"0x8D86DD82549923E"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '32151e9c-501e-0054-0bc1-9f85e6000000', + 'x-ms-client-request-id', + '194be09c-eed0-4538-bdc1-75cfea47f370', + 'x-ms-version', + '2020-02-10', + 'x-ms-content-crc64', + 'AAAAAAAAAAA=', + 'x-ms-request-server-encrypted', + 'true', + 'x-ms-version-id', + '2020-10-11T11:23:57.8877262Z', + 'Date', + 'Sun, 11 Oct 2020 11:23:57 GMT' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .post('/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=ff2898b4-369c-47c3-a476-f45ffc9064ef&client_secret=kFm4Gh3r_3ZXon03pcLz10_.X-.5mKFKrf&scope=https%3A%2F%2Fstorage.azure.com%2F.default") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCIsImtpZCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCJ9.eyJhdWQiOiJodHRwczovL3N0b3JhZ2UuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3LyIsImlhdCI6MTYwMjQxNTEzOCwibmJmIjoxNjAyNDE1MTM4LCJleHAiOjE2MDI1MDE4MzgsImFpbyI6IkUyUmdZRGgzd1VuWXhwdjNZNlovNGZ2VEgxNkhBZ0E9IiwiYXBwaWQiOiJmZjI4OThiNC0zNjljLTQ3YzMtYTQ3Ni1mNDVmZmM5MDY0ZWYiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDcvIiwib2lkIjoiMWNlMTMyNzgtYTA4My00ZDE1LTg3OTYtZGUzOTcxNzc5M2UxIiwicmgiOiIwLkFRRUF2NGo1Y3ZHR3IwR1JxeTE4MEJIYlI3U1lLUC1jTnNOSHBIYjBYX3lRWk84YUFBQS4iLCJzdWIiOiIxY2UxMzI3OC1hMDgzLTRkMTUtODc5Ni1kZTM5NzE3NzkzZTEiLCJ0aWQiOiI3MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDciLCJ1dGkiOiJhaHVlaVAzM0kwV2xVQ19xQmx3R0FBIiwidmVyIjoiMS4wIn0.vuCYt0svXFzjX6DpHwDAw2YW3bQV1hzYFQzm86EnmRWiryNU1lOK7ghay6JVLE3eFY8PTWHlMOVA1ObJHV7Tbm_JJwSNCjBdciAJOLNKgt7W3db7Xf81qd1EeRQB8rckWbbYUU91DOgM0mJJO7a2Bg6trP3bc4Tz5rBZ-ZN9Lk1Uru0zE-g9H9pUGWDPmDQKG1IWCHLBvO3tVD_7gmQH47eRYuLduaeyJE2HG_9ofoLuGMVKjZCCTpKTkb33WU5rcSD1JFe-kq6tuETnuk4tgYuJ0kiWdAolwUVZPld4XUL-oLTkK0LP9KvbUK6Q1InjHyTl0n8UwHezj6EtnQ-JXQ"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Length', + '1318', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '889e1b6a-f7fd-4523-a550-2fea065c0600', + 'x-ms-ests-server', + '2.1.11140.10 - EASLR1 ProdSlices', + 'Set-Cookie', + 'fpc=Ag9G8dNsTxNAqRBCzdn1MOl00ISJAQAAAE3iFNcOAAAA; expires=Tue, 10-Nov-2020 11:23:58 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Sun, 11 Oct 2020 11:23:57 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .post('/', "2020-10-11T11:18:58Z2020-10-12T11:23:58Z") + .query(true) + .reply(200, "1ce13278-a083-4d15-8796-de39717793e172f988bf-86f1-41af-91ab-2d7cd011db472020-10-11T11:18:58Z2020-10-12T11:23:58Zb2020-02-10p1Nm1ph5DharBcKtikPwvEHtAJ0Rm0VOOQIpkwUMwmw=", [ + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '32151ea8-501e-0054-13c1-9f85e6000000', + 'x-ms-client-request-id', + 'e91741d7-70d7-44fd-9b6a-a49ea0c9625f', + 'x-ms-version', + '2020-02-10', + 'Date', + 'Sun, 11 Oct 2020 11:23:58 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container160241543590404390/blob160241543734202002') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '32151eac-501e-0054-17c1-9f85e6000000', + 'x-ms-client-request-id', + '7ac589b3-207c-4988-95ec-ccbe04a297e2', + 'x-ms-version', + '2020-02-10', + 'x-ms-delete-type-permanent', + 'false', + 'Date', + 'Sun, 11 Oct 2020 11:23:58 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .head('/container160241543590404390/blob160241543734202002') + .query(true) + .reply(404, "", [ + 'Transfer-Encoding', + 'chunked', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '32151eb5-501e-0054-1fc1-9f85e6000000', + 'x-ms-client-request-id', + '02d583ca-da09-4c3d-86db-f9b6ba17e15c', + 'x-ms-version', + '2020-02-10', + 'x-ms-error-code', + 'BlobNotFound', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,x-ms-error-code,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Sun, 11 Oct 2020 11:23:59 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container160241543590404390') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '32151ec8-501e-0054-2dc1-9f85e6000000', + 'x-ms-client-request-id', + '261ea782-3bd1-4571-8b60-1fa89adc2703', + 'x-ms-version', + '2020-02-10', + 'Date', + 'Sun, 11 Oct 2020 11:23:59 GMT' +]); diff --git a/sdk/storage/storage-blob/sample.env b/sdk/storage/storage-blob/sample.env index 4920b5bec3c3..4757365fc4d0 100644 --- a/sdk/storage/storage-blob/sample.env +++ b/sdk/storage/storage-blob/sample.env @@ -24,7 +24,7 @@ AZURE_CLIENT_SECRET= # TEST_MODE=playback # Optional, used for testing container soft delete. -CONTAINER_SOFT_DELETE_ACCOUNT_NAME= -CONTAINER_SOFT_DELETE_ACCOUNT_KEY= -CONTAINER_SOFT_DELETE_STORAGE_CONNECTION_STRING= -CONTAINER_SOFT_DELETE_ACCOUNT_SAS= +SOFT_DELETE_ACCOUNT_NAME= +SOFT_DELETE_ACCOUNT_KEY= +SOFT_DELETE_STORAGE_CONNECTION_STRING= +SOFT_DELETE_ACCOUNT_SAS= diff --git a/sdk/storage/storage-blob/src/BlobSASSignatureValues.ts b/sdk/storage/storage-blob/src/BlobSASSignatureValues.ts index 5bcd0e00d71c..5e1a19576f83 100644 --- a/sdk/storage/storage-blob/src/BlobSASSignatureValues.ts +++ b/sdk/storage/storage-blob/src/BlobSASSignatureValues.ts @@ -311,10 +311,18 @@ export function generateBlobSASQueryParameters( if (sharedKeyCredential !== undefined) { return generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential); } else { - return generateBlobSASQueryParametersUDK20181109( - blobSASSignatureValues, - userDelegationKeyCredential! - ); + // Version 2020-02-10 delegation SAS signature construction includes preauthorizedAgentObjectId, agentObjectId, correlationId. + if (version >= "2020-02-10") { + return generateBlobSASQueryParametersUDK20200210( + blobSASSignatureValues, + userDelegationKeyCredential! + ); + } else { + return generateBlobSASQueryParametersUDK20181109( + blobSASSignatureValues, + userDelegationKeyCredential! + ); + } } } @@ -352,6 +360,8 @@ function generateBlobSASQueryParameters20150405( blobSASSignatureValues: BlobSASSignatureValues, sharedKeyCredential: StorageSharedKeyCredential ): SASQueryParameters { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + if ( !blobSASSignatureValues.identifier && !blobSASSignatureValues.permissions && @@ -362,38 +372,13 @@ function generateBlobSASQueryParameters20150405( ); } - const version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; let resource: string = "c"; - let verifiedPermissions: string | undefined; - - if (blobSASSignatureValues.snapshotTime) { - throw RangeError("'version' must be >= '2018-11-09' when provided 'snapshotTime'."); - } - - if (blobSASSignatureValues.versionId) { - throw RangeError("'version' must be >= '2019-10-10' when provided 'versionId'."); - } - if ( - blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.deleteVersion && - version < "2019-10-10" - ) { - throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission."); - } - - if ( - blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.tag && - version < "2019-12-12" - ) { - throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission."); - } - if (blobSASSignatureValues.blobName) { resource = "b"; } // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions: string | undefined; if (blobSASSignatureValues.permissions) { if (blobSASSignatureValues.blobName) { verifiedPermissions = BlobSASPermissions.parse( @@ -423,7 +408,7 @@ function generateBlobSASQueryParameters20150405( blobSASSignatureValues.identifier, blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - version, + blobSASSignatureValues.version, blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", @@ -434,7 +419,7 @@ function generateBlobSASQueryParameters20150405( const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); return new SASQueryParameters( - version, + blobSASSignatureValues.version!, signature, verifiedPermissions, undefined, @@ -474,6 +459,8 @@ function generateBlobSASQueryParameters20181109( blobSASSignatureValues: BlobSASSignatureValues, sharedKeyCredential: StorageSharedKeyCredential ): SASQueryParameters { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + if ( !blobSASSignatureValues.identifier && !blobSASSignatureValues.permissions && @@ -484,37 +471,7 @@ function generateBlobSASQueryParameters20181109( ); } - const version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; let resource: string = "c"; - let verifiedPermissions: string | undefined; - - if (blobSASSignatureValues.versionId && version < "2019-10-10") { - throw RangeError("'version' must be >= '2019-10-10' when provided 'versionId'."); - } - if ( - blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.deleteVersion && - version < "2019-10-10" - ) { - throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission."); - } - - if ( - blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.tag && - version < "2019-12-12" - ) { - throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission."); - } - - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { - throw RangeError("Must provide 'blobName' when provided 'snapshotTime'."); - } - - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) { - throw RangeError("Must provide 'blobName' when provided 'versionId'."); - } - let timestamp = blobSASSignatureValues.snapshotTime; if (blobSASSignatureValues.blobName) { resource = "b"; @@ -527,6 +484,7 @@ function generateBlobSASQueryParameters20181109( } // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions: string | undefined; if (blobSASSignatureValues.permissions) { if (blobSASSignatureValues.blobName) { verifiedPermissions = BlobSASPermissions.parse( @@ -556,7 +514,7 @@ function generateBlobSASQueryParameters20181109( blobSASSignatureValues.identifier, blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - version, + blobSASSignatureValues.version, resource, timestamp, blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", @@ -569,7 +527,7 @@ function generateBlobSASQueryParameters20181109( const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); return new SASQueryParameters( - version, + blobSASSignatureValues.version!, signature, verifiedPermissions, undefined, @@ -595,7 +553,7 @@ function generateBlobSASQueryParameters20181109( * Creates an instance of SASQueryParameters. * * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn and identifier. + * set corresponding properties directly, such as permissions, startsOn. * * WARNING: identifier will be ignored, permissions and expiresOn are required. * @@ -607,44 +565,128 @@ function generateBlobSASQueryParametersUDK20181109( blobSASSignatureValues: BlobSASSignatureValues, userDelegationKeyCredential: UserDelegationKeyCredential ): SASQueryParameters { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + + // Stored access policies are not supported for a user delegation SAS. if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { throw new RangeError( "Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS." ); } - const version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; - - if (blobSASSignatureValues.versionId && version < "2019-10-10") { - throw RangeError("'version' must be >= '2019-10-10' when provided 'versionId'."); - } - if ( - blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.deleteVersion && - version < "2019-10-10" - ) { - throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission."); + let resource: string = "c"; + let timestamp = blobSASSignatureValues.snapshotTime; + if (blobSASSignatureValues.blobName) { + resource = "b"; + if (blobSASSignatureValues.snapshotTime) { + resource = "bs"; + } else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } } - if ( - blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.tag && - version < "2019-12-12" - ) { - throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission."); + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions: string | undefined; + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions.parse( + blobSASSignatureValues.permissions.toString() + ).toString(); + } else { + verifiedPermissions = ContainerSASPermissions.parse( + blobSASSignatureValues.permissions.toString() + ).toString(); + } } - let resource: string = "c"; - let verifiedPermissions: string | undefined; + // Signature is generated on the un-url-encoded values. + const stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? truncatedISO8061Date(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? truncatedISO8061Date(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName( + userDelegationKeyCredential.accountName, + blobSASSignatureValues.containerName, + blobSASSignatureValues.blobName + ), + userDelegationKeyCredential.userDelegationKey.signedObjectId, + userDelegationKeyCredential.userDelegationKey.signedTenantId, + userDelegationKeyCredential.userDelegationKey.signedStartsOn + ? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedExpiresOn + ? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedService, + userDelegationKeyCredential.userDelegationKey.signedVersion, + blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + resource, + timestamp, + blobSASSignatureValues.cacheControl, + blobSASSignatureValues.contentDisposition, + blobSASSignatureValues.contentEncoding, + blobSASSignatureValues.contentLanguage, + blobSASSignatureValues.contentType + ].join("\n"); - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { - throw RangeError("Must provide 'blobName' when provided 'snapshotTime'."); - } + const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); + return new SASQueryParameters( + blobSASSignatureValues.version!, + signature, + verifiedPermissions, + undefined, + undefined, + blobSASSignatureValues.protocol, + blobSASSignatureValues.startsOn, + blobSASSignatureValues.expiresOn, + blobSASSignatureValues.ipRange, + blobSASSignatureValues.identifier, + resource, + blobSASSignatureValues.cacheControl, + blobSASSignatureValues.contentDisposition, + blobSASSignatureValues.contentEncoding, + blobSASSignatureValues.contentLanguage, + blobSASSignatureValues.contentType, + userDelegationKeyCredential.userDelegationKey + ); +} - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) { - throw RangeError("Must provide 'blobName' when provided 'versionId'."); +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2020-02-10. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn. + * + * WARNING: identifier will be ignored, permissions and expiresOn are required. + * + * @param {BlobSASSignatureValues} blobSASSignatureValues + * @param {UserDelegationKeyCredential} userDelegationKeyCredential + * @returns {SASQueryParameters} + */ +function generateBlobSASQueryParametersUDK20200210( + blobSASSignatureValues: BlobSASSignatureValues, + userDelegationKeyCredential: UserDelegationKeyCredential +): SASQueryParameters { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + + // Stored access policies are not supported for a user delegation SAS. + if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { + throw new RangeError( + "Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS." + ); } + let resource: string = "c"; let timestamp = blobSASSignatureValues.snapshotTime; if (blobSASSignatureValues.blobName) { resource = "b"; @@ -657,6 +699,7 @@ function generateBlobSASQueryParametersUDK20181109( } // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions: string | undefined; if (blobSASSignatureValues.permissions) { if (blobSASSignatureValues.blobName) { verifiedPermissions = BlobSASPermissions.parse( @@ -693,9 +736,12 @@ function generateBlobSASQueryParametersUDK20181109( : "", userDelegationKeyCredential.userDelegationKey.signedService, userDelegationKeyCredential.userDelegationKey.signedVersion, + undefined, // preauthorizedAgentObjectId + undefined, // agentObjectId + undefined, // correlationId blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "", blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - version, + blobSASSignatureValues.version, resource, timestamp, blobSASSignatureValues.cacheControl, @@ -706,9 +752,8 @@ function generateBlobSASQueryParametersUDK20181109( ].join("\n"); const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); - return new SASQueryParameters( - version, + blobSASSignatureValues.version!, signature, verifiedPermissions, undefined, @@ -737,3 +782,41 @@ function getCanonicalName(accountName: string, containerName: string, blobName?: } return elements.join(""); } + +function SASSignatureValuesSanityCheckAndAutofill( + blobSASSignatureValues: BlobSASSignatureValues +): BlobSASSignatureValues { + const version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION; + if (blobSASSignatureValues.snapshotTime && version < "2018-11-09") { + throw RangeError("'version' must be >= '2018-11-09' when providing 'snapshotTime'."); + } + if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { + throw RangeError("Must provide 'blobName' when providing 'snapshotTime'."); + } + + if (blobSASSignatureValues.versionId && version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when providing 'versionId'."); + } + if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) { + throw RangeError("Must provide 'blobName' when providing 'versionId'."); + } + + if ( + blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.deleteVersion && + version < "2019-10-10" + ) { + throw RangeError("'version' must be >= '2019-10-10' when providing 'x' permission."); + } + + if ( + blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.tag && + version < "2019-12-12" + ) { + throw RangeError("'version' must be >= '2019-12-12' when providing 't' permission."); + } + + blobSASSignatureValues.version = version; + return blobSASSignatureValues; +} diff --git a/sdk/storage/storage-blob/test/blobclient.spec.ts b/sdk/storage/storage-blob/test/blobclient.spec.ts index de5319471f2a..92eab09bf694 100644 --- a/sdk/storage/storage-blob/test/blobclient.spec.ts +++ b/sdk/storage/storage-blob/test/blobclient.spec.ts @@ -55,11 +55,6 @@ describe("BlobClient", () => { }); it("Set blob tags should work", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - const tags = { tag1: "val1", tag2: "val2" @@ -85,11 +80,6 @@ describe("BlobClient", () => { }); it("Get blob tags should work with a snapshot", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - const tags = { tag1: "val1", tag2: "val2" @@ -104,11 +94,6 @@ describe("BlobClient", () => { }); it("Create block blob should work with tags", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - await blockBlobClient.delete(); const tags = { @@ -122,11 +107,6 @@ describe("BlobClient", () => { }); it("Create append blob should work with tags", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - const tags = { tag1: "val1", tag2: "val2" @@ -141,11 +121,6 @@ describe("BlobClient", () => { }); it("Create page blob should work with tags", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - const tags = { tag1: "val1", tag2: "val2" @@ -828,19 +803,22 @@ describe("BlobClient", () => { await checkRehydratePriority("Standard"); }); - // Preview in STG74, limited regions and customers - it.skip("lastAccessed returned", async () => { + it("lastAccessed returned", async function() { + if (isLiveMode()) { + // Skipped for now as it's not working in live tests pipeline. + this.skip(); + } const downloadRes = await blockBlobClient.download(); - // assert.ok(downloadRes.lastAccessed); - console.log(downloadRes.lastAccessed); + assert.ok(downloadRes.lastAccessed); const getPropertiesRes = await blockBlobClient.getProperties(); - // assert.ok(getPropertiesRes.lastAccessed); - console.log(getPropertiesRes); + assert.ok(getPropertiesRes.lastAccessed); - for await (const blobItem of containerClient.listBlobsFlat()) { - console.log(blobItem.properties); - // assert.ok(blobItem.properties.lastAccessedOn); + for await (const blobItem of containerClient.listBlobsFlat({ prefix: blobName })) { + if (blobItem.name === blobName) { + assert.ok(blobItem.properties.lastAccessedOn); + break; + } } }); diff --git a/sdk/storage/storage-blob/test/blobserviceclient.spec.ts b/sdk/storage/storage-blob/test/blobserviceclient.spec.ts index 73aab11977f1..ec115032ae1b 100644 --- a/sdk/storage/storage-blob/test/blobserviceclient.spec.ts +++ b/sdk/storage/storage-blob/test/blobserviceclient.spec.ts @@ -13,7 +13,6 @@ import { } from "./utils"; import { record, delay, Recorder } from "@azure/test-utils-recorder"; import { Tags } from "../src/models"; -import { isNode } from "@azure/core-http"; dotenv.config(); describe("BlobServiceClient", () => { @@ -472,11 +471,6 @@ describe("BlobServiceClient", () => { }); it("Find blob by tags should work", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - const blobServiceClient = getBSU(); const containerName = recorder.getUniqueName("container1"); @@ -566,7 +560,7 @@ describe("BlobServiceClient", () => { it("restore container", async function() { let blobServiceClient: BlobServiceClient; try { - blobServiceClient = getGenericBSU("CONTAINER_SOFT_DELETE_"); + blobServiceClient = getGenericBSU("SOFT_DELETE_"); } catch (err) { this.skip(); } @@ -599,7 +593,7 @@ describe("BlobServiceClient", () => { it("restore container to a new name", async function() { let blobServiceClient: BlobServiceClient; try { - blobServiceClient = getGenericBSU("CONTAINER_SOFT_DELETE_"); + blobServiceClient = getGenericBSU("SOFT_DELETE_"); } catch (err) { this.skip(); } diff --git a/sdk/storage/storage-blob/test/blobversioning.spec.ts b/sdk/storage/storage-blob/test/blobversioning.spec.ts index a1a40e3c1e37..3d962eb05da3 100644 --- a/sdk/storage/storage-blob/test/blobversioning.spec.ts +++ b/sdk/storage/storage-blob/test/blobversioning.spec.ts @@ -130,11 +130,6 @@ describe("Blob versioning", () => { }); it("delete a version", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - const blobVersionClient = blobClient.withVersion(uploadRes.versionId!); await blobVersionClient.delete(); @@ -146,11 +141,6 @@ describe("Blob versioning", () => { }); it("deleteBlobs should work for batch delete", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - recorder.skip( undefined, "UUID is randomly generated within the SDK and used in the HTTP request and cannot be preserved." @@ -212,11 +202,6 @@ describe("Blob versioning", () => { }); it("deleting root blob with versionId should fail", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - await containerClient.deleteBlob(blobName, { versionId: uploadRes.versionId }); @@ -250,11 +235,6 @@ describe("Blob versioning", () => { }); it("deleting a blob that has snapshots needs deleteSnapshots option", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - const result = await blobClient.createSnapshot(); assert.ok(result.snapshot); @@ -310,11 +290,6 @@ describe("Blob versioning", () => { }); it("promote a version: as the copy source", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - const blobVersionClient = blobClient.withVersion(uploadRes.versionId!); await blobVersionClient.getProperties(); @@ -382,11 +357,6 @@ describe("Blob versioning", () => { }); it("undelete a soft-deleted version", async function() { - if (!isNode) { - // SAS in test pipeline need to support the new permission. - this.skip(); - } - let properties = await blobServiceClient.getProperties(); if (!properties.deleteRetentionPolicy!.enabled) { await blobServiceClient.setProperties({ diff --git a/sdk/storage/storage-blob/test/node/sas.spec.ts b/sdk/storage/storage-blob/test/node/sas.spec.ts index 709ebf8f3eae..c09ec5518bc1 100644 --- a/sdk/storage/storage-blob/test/node/sas.spec.ts +++ b/sdk/storage/storage-blob/test/node/sas.spec.ts @@ -18,7 +18,7 @@ import { Tags } from "../../src"; import { SASProtocol } from "../../src/SASQueryParameters"; -import { getBSU, getTokenBSU, recorderEnvSetup, sleep } from "../utils"; +import { getBSU, getTokenBSUWithDefaultCredential, recorderEnvSetup, sleep } from "../utils"; import { delay, record } from "@azure/test-utils-recorder"; import { SERVICE_VERSION } from "../../src/utils/constants"; @@ -667,11 +667,11 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { }); it("GenerateUserDelegationSAS should work for container with all configurations", async function() { - // Try to get BlobServiceClient object with TokenCredential - // when ACCOUNT_TOKEN environment variable is set + // Try to get BlobServiceClient object with DefaultCredential + // when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET environment variable is set let blobServiceClientWithToken: BlobServiceClient | undefined; try { - blobServiceClientWithToken = getTokenBSU(); + blobServiceClientWithToken = getTokenBSUWithDefaultCredential(); } catch {} // Requires bearer token for this case which cannot be generated in the runtime @@ -725,11 +725,11 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { }); it("GenerateUserDelegationSAS should work for container with minimum parameters", async function() { - // Try to get BlobServiceClient object with TokenCredential - // when ACCOUNT_TOKEN environment variable is set + // Try to get BlobServiceClient object with DefaultCredential + // when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET environment variable is set let blobServiceClientWithToken: BlobServiceClient | undefined; try { - blobServiceClientWithToken = getTokenBSU(); + blobServiceClientWithToken = getTokenBSUWithDefaultCredential(); } catch {} // Requires bearer token for this case which cannot be generated in the runtime @@ -779,11 +779,11 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { }); it("GenerateUserDelegationSAS should work for blob", async function() { - // Try to get blobServiceClient object with TokenCredential - // when ACCOUNT_TOKEN environment variable is set + // Try to get blobServiceClient object with DefaultCredential + // when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET environment variable is set let blobServiceClientWithToken: BlobServiceClient | undefined; try { - blobServiceClientWithToken = getTokenBSU(); + blobServiceClientWithToken = getTokenBSUWithDefaultCredential(); } catch {} // Requires bearer token for this case which cannot be generated in the runtime @@ -848,11 +848,11 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { }); it("GenerateUserDelegationSAS should work for blob snapshot", async function() { - // Try to get blobServiceClient object with TokenCredential - // when ACCOUNT_TOKEN environment variable is set + // Try to get blobServiceClient object with DefaultCredential + // when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET environment variable is set let blobServiceClientWithToken: BlobServiceClient | undefined; try { - blobServiceClientWithToken = getTokenBSU(); + blobServiceClientWithToken = getTokenBSUWithDefaultCredential(); } catch {} // Requires bearer token for this case which cannot be generated in the runtime @@ -1005,12 +1005,12 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { await containerClient.delete(); }); - it.skip("GenerateUserDelegationSAS should work for blob version delete", async function() { - // Try to get blobServiceClient object with TokenCredential - // when ACCOUNT_TOKEN environment variable is set + it("GenerateUserDelegationSAS should work for blob version delete", async function() { + // Try to get blobServiceClient object with DefaultCredential + // when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET environment variable is set let blobServiceClientWithToken: BlobServiceClient | undefined; try { - blobServiceClientWithToken = getTokenBSU(); + blobServiceClientWithToken = getTokenBSUWithDefaultCredential(); } catch {} // Requires bearer token for this case which cannot be generated in the runtime @@ -1051,7 +1051,8 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { ipRange: { start: "0.0.0.0", end: "255.255.255.255" }, permissions: BlobSASPermissions.parse("racwdx"), protocol: SASProtocol.HttpsAndHttp, - versionId: uploadRes.versionId + versionId: uploadRes.versionId, + version: "2019-12-12" }, userDelegationKey, accountName diff --git a/sdk/storage/storage-blob/test/utils/index.ts b/sdk/storage/storage-blob/test/utils/index.ts index 746073b6f457..0a13368eb0bb 100644 --- a/sdk/storage/storage-blob/test/utils/index.ts +++ b/sdk/storage/storage-blob/test/utils/index.ts @@ -18,6 +18,7 @@ import { import { extractConnectionStringParts } from "../../src/utils/utils.common"; import { TokenCredential } from "@azure/core-http"; import { env } from "@azure/test-utils-recorder"; +import { DefaultAzureCredential } from "@azure/identity"; dotenv.config(); @@ -98,6 +99,25 @@ export function getTokenBSU(): BlobServiceClient { return new BlobServiceClient(blobPrimaryURL, pipeline); } +export function getTokenBSUWithDefaultCredential( + pipelineOptions: StoragePipelineOptions = {}, + accountType: string = "", + accountNameSuffix: string = "" +): BlobServiceClient { + const accountNameEnvVar = `${accountType}ACCOUNT_NAME`; + let accountName = process.env[accountNameEnvVar]; + if (!accountName || accountName === "") { + throw new Error(`${accountNameEnvVar} environment variables not specified.`); + } + + const credential = new DefaultAzureCredential(); + const pipeline = newPipeline(credential, { + ...pipelineOptions + }); + const blobPrimaryURL = `https://${accountName}${accountNameSuffix}.blob.core.windows.net/`; + return new BlobServiceClient(blobPrimaryURL, pipeline); +} + export function getBSU(pipelineOptions: StoragePipelineOptions = {}): BlobServiceClient { return getGenericBSU("", undefined, pipelineOptions); } diff --git a/sdk/storage/storage-blob/test/utils/testutils.common.ts b/sdk/storage/storage-blob/test/utils/testutils.common.ts index 06c37b34c4d9..970139e19f82 100644 --- a/sdk/storage/storage-blob/test/utils/testutils.common.ts +++ b/sdk/storage/storage-blob/test/utils/testutils.common.ts @@ -32,10 +32,10 @@ export const recorderEnvSetup: RecorderEnvironmentSetup = { ORS_DEST_ACCOUNT_KEY: `${mockAccountKey}`, ORS_DEST_ACCOUNT_SAS: `${mockAccountKey}`, ORS_DEST_STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockAccountName1};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net`, - CONTAINER_SOFT_DELETE_ACCOUNT_NAME: `${mockAccountName}`, - CONTAINER_SOFT_DELETE_ACCOUNT_KEY: `${mockAccountKey}`, - CONTAINER_SOFT_DELETE_ACCOUNT_SAS: `${mockAccountKey}`, - CONTAINER_SOFT_DELETE_STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockAccountName};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net` + SOFT_DELETE_ACCOUNT_NAME: `${mockAccountName}`, + SOFT_DELETE_ACCOUNT_KEY: `${mockAccountKey}`, + SOFT_DELETE_ACCOUNT_SAS: `${mockAccountKey}`, + SOFT_DELETE_STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockAccountName};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net` }, customizationsOnRecordings: [ // Used in record mode diff --git a/sdk/storage/storage-blob/tests.yml b/sdk/storage/storage-blob/tests.yml index 12d911a20a77..6426f6c29b74 100644 --- a/sdk/storage/storage-blob/tests.yml +++ b/sdk/storage/storage-blob/tests.yml @@ -7,7 +7,8 @@ extends: ResourceServiceDirectory: storage TimeoutInMinutes: 90 ResourceGroupLocation: canadacentral - ArmTemplateParameters: '@{ enableVersioning = $true }' + SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview) + ArmTemplateParameters: "@{ enableVersioning = $true }" EnvVars: AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) diff --git a/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_for_directory_should_work_for_permissions_m_e_o_p.js b/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_for_directory_should_work_for_permissions_m_e_o_p.js index b08cd0020c6c..67c9990ef220 100644 --- a/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_for_directory_should_work_for_permissions_m_e_o_p.js +++ b/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_for_directory_should_work_for_permissions_m_e_o_p.js @@ -1,13 +1,46 @@ let nock = require('nock'); -module.exports.hash = "c632b8f565a1f09ddd0d399c60fc04aa"; +module.exports.hash = "708c30541215078483a545a7ed48f8e4"; -module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem160119116256900728","directory":"directory160119116309402910","file":"file160119116449005138"},"newDate":{"now":"2020-09-27T07:19:21.139Z","tmr":"2020-09-27T07:19:21.140Z"}} +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem160247302507606970","directory":"directory160247302565004091","file":"file160247302685708932"},"newDate":{"now":"2020-10-12T03:23:43.407Z","tmr":"2020-10-12T03:23:43.407Z"}} + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .post('/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=ff2898b4-369c-47c3-a476-f45ffc9064ef&client_secret=kFm4Gh3r_3ZXon03pcLz10_.X-.5mKFKrf&scope=https%3A%2F%2Fstorage.azure.com%2F.default") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCIsImtpZCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCJ9.eyJhdWQiOiJodHRwczovL3N0b3JhZ2UuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3LyIsImlhdCI6MTYwMjQ3MjcyMywibmJmIjoxNjAyNDcyNzIzLCJleHAiOjE2MDI1NTk0MjMsImFpbyI6IkUyUmdZTkRvZGVYK24yUXlUMExWVVduL2c1OFpBQT09IiwiYXBwaWQiOiJmZjI4OThiNC0zNjljLTQ3YzMtYTQ3Ni1mNDVmZmM5MDY0ZWYiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDcvIiwib2lkIjoiMWNlMTMyNzgtYTA4My00ZDE1LTg3OTYtZGUzOTcxNzc5M2UxIiwicmgiOiIwLkFRRUF2NGo1Y3ZHR3IwR1JxeTE4MEJIYlI3U1lLUC1jTnNOSHBIYjBYX3lRWk84YUFBQS4iLCJzdWIiOiIxY2UxMzI3OC1hMDgzLTRkMTUtODc5Ni1kZTM5NzE3NzkzZTEiLCJ0aWQiOiI3MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDciLCJ1dGkiOiJib3RfZTQweDgwMndRcjVPUzhvSUFBIiwidmVyIjoiMS4wIn0.RT6XgNmlirKmhblrikE1hvjSizUDh2ccTYy8-TcoHolmbmZljOaXd6SoTU-5Rg-pJjJ5L_cphNBOJbAYdKr2uc7ljiYJIBGb5DG4eeAn_bmDc-pkLE0Pg8t85YNN7qsLLsBY3g72bomugAbpJrNzcxmbdhecDbWlnfBd-uNLrUx5UU2GG-fIvcJwNcdXR4FF9NMQL1_foedvRa7duby8bT_2tlDbVhWxj90gOyICqJuTrt8xRSUsuwHB7iv65Tk-QpY-kzujWrjN2nVvArtBwrOKYTRXlMMYL1rKAQ7AR350Te7A5m12a0llU_jt9obto2p5a7v65-qgz2b39Sefig"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '7b7f8b6e-318d-4df3-b042-be4e4bca0800', + 'x-ms-ests-server', + '2.1.11140.10 - EASLR2 ProdSlices', + 'Set-Cookie', + 'fpc=AhvzNso4ngZCiGwSF8LBR0B00ISJAQAAAD_DFdcOAAAA; expires=Wed, 11-Nov-2020 03:23:43 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Mon, 12 Oct 2020 03:23:43 GMT', + 'Content-Length', + '1318' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .post('/', "2020-09-27T06:19:21Z2020-10-02T07:19:21Z") + .post('/', "2020-10-12T02:23:43Z2020-10-17T03:23:43Z") .query(true) - .reply(200, "1ce13278-a083-4d15-8796-de39717793e172f988bf-86f1-41af-91ab-2d7cd011db472020-09-27T06:19:21Z2020-10-02T07:19:21Zb2020-02-10l4kTXsRyr0o+LQCeJFCYgeIHfdbKrPqfwDeQzdtzjtw=", [ + .reply(200, "1ce13278-a083-4d15-8796-de39717793e172f988bf-86f1-41af-91ab-2d7cd011db472020-10-12T02:23:43Z2020-10-17T03:23:43Zb2020-02-10ZuqeCQNc3LpN4vWJ1cnifrexezH8dlKLHU5Ijw6sthE=", [ 'Transfer-Encoding', 'chunked', 'Content-Type', @@ -15,89 +48,89 @@ nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParam 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '01da158f-b01e-0095-069e-94a515000000', + '43e8bab2-401e-0038-3347-a0e960000000', 'x-ms-client-request-id', - '37bb5e48-dd76-4402-b71a-19ef6c02c364', + 'dd9c1cfb-5830-4fe2-904c-9e0d255c20ad', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 07:19:21 GMT' + 'Mon, 12 Oct 2020 03:23:44 GMT' ]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119116256900728') + .put('/filesystem160247302507606970') .query(true) .reply(201, "", [ 'Content-Length', '0', 'Last-Modified', - 'Sun, 27 Sep 2020 07:19:22 GMT', + 'Mon, 12 Oct 2020 03:23:45 GMT', 'ETag', - '"0x8D862B5A87340F9"', + '"0x8D86E5E3A1870AF"', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '01da15ac-b01e-0095-1b9e-94a515000000', + '43e8bafd-401e-0038-6a47-a0e960000000', 'x-ms-client-request-id', - '0922c281-181c-460c-9a85-9df62e3479c5', + '62a9dfc2-ef9a-4448-9dc7-8629ac1b0f6e', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 07:19:22 GMT' + 'Mon, 12 Oct 2020 03:23:45 GMT' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119116256900728/directory160119116309402910') + .put('/filesystem160247302507606970/directory160247302565004091') .query(true) .reply(201, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 07:19:24 GMT', + 'Mon, 12 Oct 2020 03:23:46 GMT', 'ETag', - '"0x8D862B5A965E89F"', + '"0x8D86E5E3AE70DA5"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '6168ec27-901f-0082-239e-940c1e000000', + '2fddc4bc-a01f-0052-5a47-a03148000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '9b4b8f35-60d0-45ad-837b-424cf18e27fc', + '8af339dc-14d3-48cc-bfa0-3298bbbf56fc', 'Date', - 'Sun, 27 Sep 2020 07:19:24 GMT', + 'Mon, 12 Oct 2020 03:23:46 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119116256900728/directory160119116309402910/file160119116449005138') + .put('/filesystem160247302507606970/directory160247302565004091/file160247302685708932') .query(true) .reply(201, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 07:19:24 GMT', + 'Mon, 12 Oct 2020 03:23:47 GMT', 'ETag', - '"0x8D862B5A9950CAE"', + '"0x8D86E5E3B1F72ED"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '6168ec33-901f-0082-2e9e-940c1e000000', + '2fddc4bd-a01f-0052-5b47-a03148000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - 'f8dbc4ca-1d77-466f-bf4b-49de6aec966e', + '094ff7ff-143d-4b8f-809b-f855520d822c', 'Date', - 'Sun, 27 Sep 2020 07:19:24 GMT', + 'Mon, 12 Oct 2020 03:23:46 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .head('/filesystem160119116256900728/directory160119116309402910') + .head('/filesystem160247302507606970/directory160247302565004091') .query(true) .reply(200, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 07:19:24 GMT', + 'Mon, 12 Oct 2020 03:23:46 GMT', 'ETag', - '"0x8D862B5A965E89F"', + '"0x8D86E5E3AE70DA5"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-owner', @@ -109,41 +142,41 @@ nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams 'x-ms-acl', 'user::rwx,group::r-x,other::---', 'x-ms-request-id', - '6168ec34-901f-0082-2f9e-940c1e000000', + '2fddc4be-a01f-0052-5c47-a03148000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - 'c253ee46-9f26-450a-bb48-0b3b7958fdf0', + '6a74a75d-f110-47b2-865b-45f1f65b5ae3', 'Date', - 'Sun, 27 Sep 2020 07:19:24 GMT' + 'Mon, 12 Oct 2020 03:23:46 GMT' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .patch('/filesystem160119116256900728/directory160119116309402910') + .patch('/filesystem160247302507606970/directory160247302565004091') .query(true) .reply(200, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 07:19:24 GMT', + 'Mon, 12 Oct 2020 03:23:46 GMT', 'ETag', - '"0x8D862B5A965E89F"', + '"0x8D86E5E3AE70DA5"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-namespace-enabled', 'true', 'x-ms-request-id', - '549fca7e-301f-0040-509e-944a98000000', + '73e65ae4-e01f-0021-1c47-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - 'dff76112-3a80-46cf-81b6-973d7d21ddb1', + '6c997777-5fea-418c-85d6-2b674886ed0e', 'Date', - 'Sun, 27 Sep 2020 07:19:25 GMT', + 'Mon, 12 Oct 2020 03:23:47 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .delete('/filesystem160119116256900728') + .delete('/filesystem160247302507606970') .query(true) .reply(202, "", [ 'Content-Length', @@ -151,11 +184,11 @@ nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParam 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '01da173b-b01e-0095-389e-94a515000000', + '43e8bce1-401e-0038-6647-a0e960000000', 'x-ms-client-request-id', - '63894e3c-0bd7-4be0-ab5a-37b4b4ea38c4', + 'be941dbf-93b1-4624-acb4-0b99a15078f6', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 07:19:25 GMT' + 'Mon, 12 Oct 2020 03:23:48 GMT' ]); diff --git a/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_should_work_with_agentobjectid_preauthorizedagentobjectid.js b/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_should_work_with_agentobjectid_preauthorizedagentobjectid.js index b53f123829d8..7df6adf032f3 100644 --- a/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_should_work_with_agentobjectid_preauthorizedagentobjectid.js +++ b/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_should_work_with_agentobjectid_preauthorizedagentobjectid.js @@ -2,12 +2,45 @@ let nock = require('nock'); module.exports.hash = "3989fdb0b96130e65077bdaf1ec162cc"; -module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem160119534928207862","directory":"directory160119535006806265","file":"file160119535129300958","newFile":"newFile160119535219701256"},"newDate":{"now":"2020-09-27T08:29:07.896Z","tmr":"2020-09-27T08:29:07.899Z"}} +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem160247303001502074","directory":"directory160247303043007345","file":"file160247303076405522","newFile":"newFile160247303151006565"},"newDate":{"now":"2020-10-12T03:23:49.289Z","tmr":"2020-10-12T03:23:49.289Z"}} + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .post('/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=ff2898b4-369c-47c3-a476-f45ffc9064ef&client_secret=kFm4Gh3r_3ZXon03pcLz10_.X-.5mKFKrf&scope=https%3A%2F%2Fstorage.azure.com%2F.default") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCIsImtpZCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCJ9.eyJhdWQiOiJodHRwczovL3N0b3JhZ2UuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3LyIsImlhdCI6MTYwMjQ3MjcyOSwibmJmIjoxNjAyNDcyNzI5LCJleHAiOjE2MDI1NTk0MjksImFpbyI6IkUyUmdZT2g0N1Zla092MTQ5OFYwNTR3ZERQN0xBQT09IiwiYXBwaWQiOiJmZjI4OThiNC0zNjljLTQ3YzMtYTQ3Ni1mNDVmZmM5MDY0ZWYiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDcvIiwib2lkIjoiMWNlMTMyNzgtYTA4My00ZDE1LTg3OTYtZGUzOTcxNzc5M2UxIiwicmgiOiIwLkFRRUF2NGo1Y3ZHR3IwR1JxeTE4MEJIYlI3U1lLUC1jTnNOSHBIYjBYX3lRWk84YUFBQS4iLCJzdWIiOiIxY2UxMzI3OC1hMDgzLTRkMTUtODc5Ni1kZTM5NzE3NzkzZTEiLCJ0aWQiOiI3MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDciLCJ1dGkiOiJScEZ4TFFzVklFT2I5UlVKRjVNSkFBIiwidmVyIjoiMS4wIn0.iGGmmP4BEY46WU4wXESjen5Fv_ijUmK8Nvl9P4PttAMxY0GED1jDA2cNJ45KnV6e40WESXFqnD2_NMThVdImXb-vHtf4LLZ6zMoZImDv_F01_TOULdMbq2peLhEe6K70hoE07yNRvtoA95WJQkJF8bRrOwXs3RE9zOohnyibYgRUbAInE6WS3Vd6VWgbp1R2NI7b1esI2d4O-2fO2Kz5EU0vPoFeUBvaNBV4awopk_pfcfBFxwXVt1uQzf2TB4Upfc9rcjh0ZynvzdNjittWP07p_TrlNjh3hp6R5XvFgMceJkctzU9vYJDYxK2iNEnZIZbuGYS5fiSCYJUjO3dSZw"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '2d719146-150b-4320-9bf5-150917930900', + 'x-ms-ests-server', + '2.1.11140.10 - EASLR2 ProdSlices', + 'Set-Cookie', + 'fpc=Ahku0QBBxxRIrvi1T6t9G3d00ISJAQAAAEXDFdcOAAAA; expires=Wed, 11-Nov-2020 03:23:49 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Mon, 12 Oct 2020 03:23:49 GMT', + 'Content-Length', + '1318' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .post('/', "2020-09-27T07:29:07Z2020-10-02T08:29:07Z") + .post('/', "2020-10-12T02:23:49Z2020-10-17T03:23:49Z") .query(true) - .reply(200, "1ce13278-a083-4d15-8796-de39717793e172f988bf-86f1-41af-91ab-2d7cd011db472020-09-27T07:29:07Z2020-10-02T08:29:07Zb2020-02-10n7l+WyBU729HYlmsyySs+b1doLOdUjpiyNGwih71kdA=", [ + .reply(200, "1ce13278-a083-4d15-8796-de39717793e172f988bf-86f1-41af-91ab-2d7cd011db472020-10-12T02:23:49Z2020-10-17T03:23:49Zb2020-02-10z/C7TXpdA1dXU73klqDHeVE0aJGzoZQhDWQy+/qNLr4=", [ 'Transfer-Encoding', 'chunked', 'Content-Type', @@ -15,131 +48,131 @@ nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParam 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '3a8db1f9-e01e-0088-4ba8-94a8a9000000', + '43e8bd64-401e-0038-4e47-a0e960000000', 'x-ms-client-request-id', - '94edd8a1-7450-4b2f-b1f4-a9f3b9972568', + 'd18c32a7-2b06-4267-bd88-dcb6e5779154', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 08:29:09 GMT' + 'Mon, 12 Oct 2020 03:23:49 GMT' ]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119534928207862') + .put('/filesystem160247303001502074') .query(true) .reply(201, "", [ 'Content-Length', '0', 'Last-Modified', - 'Sun, 27 Sep 2020 08:29:09 GMT', + 'Mon, 12 Oct 2020 03:23:50 GMT', 'ETag', - '"0x8D862BF680168AD"', + '"0x8D86E5E3CFBF3C3"', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '3a8db24b-e01e-0088-7ba8-94a8a9000000', + '43e8bdb3-401e-0038-1147-a0e960000000', 'x-ms-client-request-id', - '116e3845-066b-48f9-8860-015fd152ec8f', + '886086ee-2394-4981-8d5a-311d0b26b6d3', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 08:29:09 GMT' + 'Mon, 12 Oct 2020 03:23:49 GMT' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119534928207862/directory160119535006806265') + .put('/filesystem160247303001502074/directory160247303043007345') .query(true) .reply(201, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 08:29:11 GMT', + 'Mon, 12 Oct 2020 03:23:50 GMT', 'ETag', - '"0x8D862BF68EA46EC"', + '"0x8D86E5E3D3B924E"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '4e38adcf-201f-0001-80a8-94127c000000', + '73e65aef-e01f-0021-1f47-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - 'b9e61ccd-859d-4ac2-8e77-373c75e355e0', + 'db117da3-5c32-4851-968f-79130e95ac58', 'Date', - 'Sun, 27 Sep 2020 08:29:10 GMT', + 'Mon, 12 Oct 2020 03:23:49 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119534928207862/directory160119535006806265/file160119535129300958') + .put('/filesystem160247303001502074/directory160247303043007345/file160247303076405522') .query(true) .reply(201, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 08:29:11 GMT', + 'Mon, 12 Oct 2020 03:23:50 GMT', 'ETag', - '"0x8D862BF692346C1"', + '"0x8D86E5E3D7032AC"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '4e38add0-201f-0001-01a8-94127c000000', + '73e65af0-e01f-0021-2047-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '13bc96e3-4e77-4654-aafc-f4410bcb5eb3', + '1515006c-b261-490f-82ac-c73631af5940', 'Date', - 'Sun, 27 Sep 2020 08:29:10 GMT', + 'Mon, 12 Oct 2020 03:23:50 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .patch('/filesystem160119534928207862/%2F') + .patch('/filesystem160247303001502074/%2F') .query(true) .reply(200, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 08:29:09 GMT', + 'Mon, 12 Oct 2020 03:23:50 GMT', 'ETag', - '"0x8D862BF682FEFE2"', + '"0x8D86E5E3CFD6BE8"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-namespace-enabled', 'true', 'x-ms-request-id', - '4e38add2-201f-0001-03a8-94127c000000', + '73e65af2-e01f-0021-2147-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - 'b3bc8ae1-c329-4c40-972a-8344e7638b0c', + '506acb84-2c9d-4dc2-ab05-cb1f3dc93de9', 'Date', - 'Sun, 27 Sep 2020 08:29:11 GMT', + 'Mon, 12 Oct 2020 03:23:50 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119534928207862/newFile160119535219701256') + .put('/filesystem160247303001502074/newFile160247303151006565') .query(true) .reply(201, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 08:29:12 GMT', + 'Mon, 12 Oct 2020 03:23:51 GMT', 'ETag', - '"0x8D862BF69C60FD2"', + '"0x8D86E5E3DEAFD9D"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '4e38add4-201f-0001-05a8-94127c000000', + '73e65af3-e01f-0021-2247-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '8ad6f1e6-ebc3-490a-a66c-43a44547afe3', + '389f1b65-e657-445f-bb95-1e7afec6e5c8', 'Date', - 'Sun, 27 Sep 2020 08:29:11 GMT', + 'Mon, 12 Oct 2020 03:23:50 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119534928207862/newFile160119535219701256') + .put('/filesystem160247303001502074/newFile160247303151006565') .query(true) - .reply(403, {"error":{"code":"AuthorizationPermissionMismatch","message":"This request is not authorized to perform this operation using this permission.\nRequestId:4e38add5-201f-0001-06a8-94127c000000\nTime:2020-09-27T08:29:12.9183732Z"}}, [ + .reply(403, {"error":{"code":"AuthorizationPermissionMismatch","message":"This request is not authorized to perform this operation using this permission.\nRequestId:73e65af4-e01f-0021-2347-a069db000000\nTime:2020-10-12T03:23:52.1671055Z"}}, [ 'Content-Length', '227', 'Content-Type', @@ -149,19 +182,19 @@ nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams 'x-ms-error-code', 'AuthorizationPermissionMismatch', 'x-ms-request-id', - '4e38add5-201f-0001-06a8-94127c000000', + '73e65af4-e01f-0021-2347-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '081286cf-8a72-4c92-8ae4-ca8c9a2b7891', + '51402467-f5f5-4a15-b80f-f185e8725d70', 'Date', - 'Sun, 27 Sep 2020 08:29:12 GMT' + 'Mon, 12 Oct 2020 03:23:51 GMT' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119534928207862/newFile160119535219701256') + .put('/filesystem160247303001502074/newFile160247303151006565') .query(true) - .reply(409, {"error":{"code":"PathAlreadyExists","message":"The specified path already exists.\nRequestId:4e38add6-201f-0001-07a8-94127c000000\nTime:2020-09-27T08:29:13.2576143Z"}}, [ + .reply(409, {"error":{"code":"PathAlreadyExists","message":"The specified path already exists.\nRequestId:73e65af5-e01f-0021-2447-a069db000000\nTime:2020-10-12T03:23:52.5373681Z"}}, [ 'Content-Length', '168', 'Content-Type', @@ -171,17 +204,17 @@ nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams 'x-ms-error-code', 'PathAlreadyExists', 'x-ms-request-id', - '4e38add6-201f-0001-07a8-94127c000000', + '73e65af5-e01f-0021-2447-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '0dbc702c-fb99-41c3-bbda-16eddd89e264', + 'a0861359-0b59-494b-9edb-82234f029d74', 'Date', - 'Sun, 27 Sep 2020 08:29:12 GMT' + 'Mon, 12 Oct 2020 03:23:51 GMT' ]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .delete('/filesystem160119534928207862') + .delete('/filesystem160247303001502074') .query(true) .reply(202, "", [ 'Content-Length', @@ -189,11 +222,11 @@ nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParam 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '3a8db511-e01e-0088-44a8-94a8a9000000', + '43e8bf2b-401e-0038-5547-a0e960000000', 'x-ms-client-request-id', - 'b0b4dd4a-93cd-4dde-88e7-d15c2271455d', + 'fbcc3c71-547a-4a3f-b1e8-b5e3708268c1', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 08:29:13 GMT' + 'Mon, 12 Oct 2020 03:23:52 GMT' ]); diff --git a/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_should_work_with_correlationid.js b/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_should_work_with_correlationid.js index acd90fb18815..3627b3080fb4 100644 --- a/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_should_work_with_correlationid.js +++ b/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_delegation_sas/recording_generateuserdelegationsas_should_work_with_correlationid.js @@ -2,12 +2,45 @@ let nock = require('nock'); module.exports.hash = "9bcada1e1c90bd5e6d1bdb8e5fa637b4"; -module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem160119597598007601","directory":"directory160119597641207244","file":"file160119597792806566"},"newDate":{"now":"2020-09-27T08:39:34.507Z","tmr":"2020-09-27T08:39:34.508Z"}} +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem160247303378304306","directory":"directory160247303414603572","file":"file160247303447805870"},"newDate":{"now":"2020-10-12T03:23:53.125Z","tmr":"2020-10-12T03:23:53.125Z"}} + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .post('/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=ff2898b4-369c-47c3-a476-f45ffc9064ef&client_secret=kFm4Gh3r_3ZXon03pcLz10_.X-.5mKFKrf&scope=https%3A%2F%2Fstorage.azure.com%2F.default") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCIsImtpZCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCJ9.eyJhdWQiOiJodHRwczovL3N0b3JhZ2UuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3LyIsImlhdCI6MTYwMjQ3MjczMywibmJmIjoxNjAyNDcyNzMzLCJleHAiOjE2MDI1NTk0MzMsImFpbyI6IkUyUmdZTmk5OE5xV1pEYXhXajk1ZTY3TFMyYmNCUUE9IiwiYXBwaWQiOiJmZjI4OThiNC0zNjljLTQ3YzMtYTQ3Ni1mNDVmZmM5MDY0ZWYiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDcvIiwib2lkIjoiMWNlMTMyNzgtYTA4My00ZDE1LTg3OTYtZGUzOTcxNzc5M2UxIiwicmgiOiIwLkFRRUF2NGo1Y3ZHR3IwR1JxeTE4MEJIYlI3U1lLUC1jTnNOSHBIYjBYX3lRWk84YUFBQS4iLCJzdWIiOiIxY2UxMzI3OC1hMDgzLTRkMTUtODc5Ni1kZTM5NzE3NzkzZTEiLCJ0aWQiOiI3MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDciLCJ1dGkiOiJyU1k3VXBBSERVV2o3bEVIVnpvSkFBIiwidmVyIjoiMS4wIn0.HGFjcj33xfmtJMEtJQZSWwfFIGtC2aqQOj5j-m-5X-4WOXuRuWDbK12cLx3GbKdZpNsF4iUpkkHSHzpMGS0j4jwb0UWSjhb-ak5-GWRcBZOgmySN-hdmuess1ZPVKS_ypo6TCgUwXhxVjHXbDUm3MaizGNYkRBcLgMxxDInEqHbBxADOyPO3qj8jzIJf7okmxvW1nc8awKuHYj99X2dqx_6NZkUN1YpU0m4Lv_TMeNqZYposssC-uSL7VFl5Zj0KAyphPaX_kh9-UIAmEfYUn6m7mmeGSworKbnp2QNpDXA0NMLDo7bWU84NNW9PhsuDBoPhxbbg6MvOeTEu24gYWQ"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Length', + '1318', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '523b26ad-0790-450d-a3ee-5107573a0900', + 'x-ms-ests-server', + '2.1.11140.10 - SEASLR2 ProdSlices', + 'Set-Cookie', + 'fpc=AgqPwKQnGtZFuxTMFm025R500ISJAQAAAEjDFdcOAAAA; expires=Wed, 11-Nov-2020 03:23:53 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Mon, 12 Oct 2020 03:23:52 GMT' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .post('/', "2020-09-27T07:39:34Z2020-10-02T08:39:34Z") + .post('/', "2020-10-12T02:23:53Z2020-10-17T03:23:53Z") .query(true) - .reply(200, "1ce13278-a083-4d15-8796-de39717793e172f988bf-86f1-41af-91ab-2d7cd011db472020-09-27T07:39:34Z2020-10-02T08:39:34Zb2020-02-10UqyKLG9BCI93ihy03vAzqHDOf1yE/ljQ1+SobVbO1tU=", [ + .reply(200, "1ce13278-a083-4d15-8796-de39717793e172f988bf-86f1-41af-91ab-2d7cd011db472020-10-12T02:23:53Z2020-10-17T03:23:53Zb2020-02-10jInP+/FisOZA2e7EoAwLHGNy+s5iA6x2x4647UpLQew=", [ 'Transfer-Encoding', 'chunked', 'Content-Type', @@ -15,85 +48,85 @@ nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParam 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '1b1d61a4-f01e-003d-51a9-943bbb000000', + '43e8bfa1-401e-0038-2c47-a0e960000000', 'x-ms-client-request-id', - '710bf4c1-4023-48b0-8e8f-9f39ae2eae92', + '3c60bd16-306e-43a0-bd72-2593c5b1e0b8', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 08:39:35 GMT' + 'Mon, 12 Oct 2020 03:23:53 GMT' ]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119597598007601') + .put('/filesystem160247303378304306') .query(true) .reply(201, "", [ 'Content-Length', '0', 'Last-Modified', - 'Sun, 27 Sep 2020 08:39:36 GMT', + 'Mon, 12 Oct 2020 03:23:53 GMT', 'ETag', - '"0x8D862C0DD7905C7"', + '"0x8D86E5E3F3D25C1"', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '1b1d61e0-f01e-003d-7da9-943bbb000000', + '43e8bfc1-401e-0038-4547-a0e960000000', 'x-ms-client-request-id', - '4c8b5dfc-bcee-4c71-aca0-d260c0287314', + '241d2903-3065-4ef4-b959-a988adaa3471', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 08:39:36 GMT' + 'Mon, 12 Oct 2020 03:23:53 GMT' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119597598007601/directory160119597641207244') + .put('/filesystem160247303378304306/directory160247303414603572') .query(true) .reply(201, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 08:39:37 GMT', + 'Mon, 12 Oct 2020 03:23:54 GMT', 'ETag', - '"0x8D862C0DE67DAFD"', + '"0x8D86E5E3F726659"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '33e3a1f6-101f-0057-7ca9-94e393000000', + '73e65af6-e01f-0021-2547-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '7b67d1f1-cc31-4e36-8336-939bc3908800', + '3ed56ba8-ff38-47b3-8eb2-d7ac724dab9a', 'Date', - 'Sun, 27 Sep 2020 08:39:37 GMT', + 'Mon, 12 Oct 2020 03:23:53 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119597598007601/directory160119597641207244/file160119597792806566') + .put('/filesystem160247303378304306/directory160247303414603572/file160247303447805870') .query(true) .reply(201, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 08:39:38 GMT', + 'Mon, 12 Oct 2020 03:23:54 GMT', 'ETag', - '"0x8D862C0DEA4F54D"', + '"0x8D86E5E3FA61625"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '33e3a1f7-101f-0057-7da9-94e393000000', + '73e65af7-e01f-0021-2647-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '56895691-579b-4230-8ab3-a58f39b4c9ef', + '63642f26-8148-4f58-8096-d1df0e616de0', 'Date', - 'Sun, 27 Sep 2020 08:39:37 GMT', + 'Mon, 12 Oct 2020 03:23:53 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .get('/filesystem160119597598007601') + .get('/filesystem160247303378304306') .query(true) - .reply(200, {"paths":[{"contentLength":"0","creationTime":"132456695777516285","etag":"0x8D862C0DE67DAFD","group":"1ce13278-a083-4d15-8796-de39717793e1","isDirectory":"true","lastModified":"Sun, 27 Sep 2020 08:39:37 GMT","name":"directory160119597641207244","owner":"1ce13278-a083-4d15-8796-de39717793e1","permissions":"rwxr-x---"}]}, [ + .reply(200, {"paths":[{"contentLength":"0","creationTime":"Mon, 12 Oct 2020 03:23:54 GMT","etag":"0x8D86E5E3F726659","group":"1ce13278-a083-4d15-8796-de39717793e1","isDirectory":"true","lastModified":"Mon, 12 Oct 2020 03:23:54 GMT","name":"directory160247303414603572","owner":"1ce13278-a083-4d15-8796-de39717793e1","permissions":"rwxr-x---"}]}, [ 'Transfer-Encoding', 'chunked', 'Content-Type', @@ -101,17 +134,17 @@ nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '33e3a1f9-101f-0057-7fa9-94e393000000', + '73e65af8-e01f-0021-2747-a069db000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - 'fa21bb63-ab4b-478c-bb08-fc778074b83c', + '97027f4f-4117-4c56-8325-8cbd3a63bfdd', 'Date', - 'Sun, 27 Sep 2020 08:39:38 GMT' + 'Mon, 12 Oct 2020 03:23:54 GMT' ]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .delete('/filesystem160119597598007601') + .delete('/filesystem160247303378304306') .query(true) .reply(202, "", [ 'Content-Length', @@ -119,11 +152,11 @@ nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParam 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '1b1d63e6-f01e-003d-77a9-943bbb000000', + '43e8c082-401e-0038-5447-a0e960000000', 'x-ms-client-request-id', - 'a00f26d0-3f9c-4325-a614-29826a2ef10f', + 'f50aa96c-675c-4591-93b6-7f1173773750', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 08:39:39 GMT' + 'Mon, 12 Oct 2020 03:23:54 GMT' ]); diff --git a/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_directory_sas/recording_generatedatalakesasqueryparameters_for_file_should_work_for_permissions_m_e_o_p.js b/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_directory_sas/recording_generatedatalakesasqueryparameters_for_file_should_work_for_permissions_m_e_o_p.js index 71abec903441..ea51cd2f43e5 100644 --- a/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_directory_sas/recording_generatedatalakesasqueryparameters_for_file_should_work_for_permissions_m_e_o_p.js +++ b/sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_directory_sas/recording_generatedatalakesasqueryparameters_for_file_should_work_for_permissions_m_e_o_p.js @@ -1,87 +1,111 @@ let nock = require('nock'); -module.exports.hash = "39f7c5fcace29f8de1b67dc28f7ed4f6"; +module.exports.hash = "e78a610b2e9f5da5139546e4cecffda6"; -module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem160119086295008444","directory":"directory160119086329007780","file":"file160119086365704236"},"newDate":{"now":"2020-09-27T07:14:24.025Z","tmr":"2020-09-27T07:14:24.026Z"}} +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem160257624536405504","directory":"directory160257624730204552","file":"file160257624860209355"},"newDate":{"now":"2020-10-13T08:04:08.916Z","tmr":"2020-10-13T08:04:08.918Z"}} nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119086295008444') + .put('/filesystem160257624536405504') .query(true) .reply(201, "", [ 'Content-Length', '0', 'Last-Modified', - 'Sun, 27 Sep 2020 07:14:23 GMT', + 'Tue, 13 Oct 2020 08:04:06 GMT', 'ETag', - '"0x8D862B4F5DADB98"', + '"0x8D86F4E8EBF8128"', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '3951018b-a01e-001f-6c9d-94fea4000000', + '5d6ceaf0-c01e-007b-6f37-a10f3c000000', 'x-ms-client-request-id', - 'a006ad22-f730-44d0-b9c1-2a22121094ac', + 'e981c8da-e1a7-489c-a559-94239299b0c3', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 07:14:22 GMT' + 'Tue, 13 Oct 2020 08:04:06 GMT' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119086295008444/directory160119086329007780') + .put('/filesystem160257624536405504/directory160257624730204552') .query(true) .reply(201, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 07:14:23 GMT', + 'Tue, 13 Oct 2020 08:04:08 GMT', 'ETag', - '"0x8D862B4F613F1CD"', + '"0x8D86F4E8FDCE8BB"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - 'd79f91db-401f-005a-6e9d-942b47000000', + '957aa5e5-701f-0033-0437-a1120b000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '52ce7a5d-fca8-4500-a2fb-29ef5dc5656d', + '30ad1f67-30ab-4cd8-9fda-28a5a88b859f', 'Date', - 'Sun, 27 Sep 2020 07:14:22 GMT', + 'Tue, 13 Oct 2020 08:04:07 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .put('/filesystem160119086295008444/directory160119086329007780/file160119086365704236') + .put('/filesystem160257624536405504/directory160257624730204552/file160257624860209355') .query(true) .reply(201, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 07:14:23 GMT', + 'Tue, 13 Oct 2020 08:04:08 GMT', 'ETag', - '"0x8D862B4F64C2D26"', + '"0x8D86F4E900C8E68"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - 'd79f91e0-401f-005a-739d-942b47000000', + '957aa5e6-701f-0033-0537-a1120b000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '47de2d9a-cacd-4beb-b7d6-5361d535a1bc', + '533138f5-062d-4556-aa89-af55a6042044', 'Date', - 'Sun, 27 Sep 2020 07:14:22 GMT', + 'Tue, 13 Oct 2020 08:04:07 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .head('/filesystem160119086295008444/directory160119086329007780/file160119086365704236') + .patch('/filesystem160257624536405504/directory160257624730204552/file160257624860209355') .query(true) .reply(200, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 07:14:23 GMT', + 'Tue, 13 Oct 2020 08:04:08 GMT', 'ETag', - '"0x8D862B4F64C2D26"', + '"0x8D86F4E900C8E68"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-namespace-enabled', + 'true', + 'x-ms-request-id', + '957aa5e7-701f-0033-0637-a1120b000000', + 'x-ms-version', + '2020-02-10', + 'x-ms-client-request-id', + '93524792-7c74-4e95-80d1-e8c28e7783f2', + 'Date', + 'Tue, 13 Oct 2020 08:04:08 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .head('/filesystem160257624536405504/directory160257624730204552/file160257624860209355') + .query(true) + .reply(200, "", [ + 'Last-Modified', + 'Tue, 13 Oct 2020 08:04:08 GMT', + 'ETag', + '"0x8D86F4E900C8E68"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-owner', - '$superuser', + 'b77d5205-ddb5-42e1-80ee-26c74a5e9333', 'x-ms-group', '$superuser', 'x-ms-permissions', @@ -89,41 +113,41 @@ nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams 'x-ms-acl', 'user::rw-,group::r--,other::---', 'x-ms-request-id', - 'd79f91e2-401f-005a-759d-942b47000000', + '957aa5e8-701f-0033-0737-a1120b000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - 'e2dd6f54-a0ad-426c-b0ee-c950f2ee5767', + '78e61c93-eb93-4fad-b450-059e7d565024', 'Date', - 'Sun, 27 Sep 2020 07:14:23 GMT' + 'Tue, 13 Oct 2020 08:04:08 GMT' ]); nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) - .patch('/filesystem160119086295008444/directory160119086329007780/file160119086365704236') + .patch('/filesystem160257624536405504/directory160257624730204552/file160257624860209355') .query(true) .reply(200, "", [ 'Last-Modified', - 'Sun, 27 Sep 2020 07:14:23 GMT', + 'Tue, 13 Oct 2020 08:04:08 GMT', 'ETag', - '"0x8D862B4F64C2D26"', + '"0x8D86F4E900C8E68"', 'Server', 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-namespace-enabled', 'true', 'x-ms-request-id', - '0453a43a-301f-007f-389d-94823b000000', + '51bd62b8-d01f-0077-0e37-a19834000000', 'x-ms-version', '2020-02-10', 'x-ms-client-request-id', - '26bd1ab0-8b60-4188-bfa4-25b45030e1b4', + 'cd263711-b23b-4770-9e70-514b27efe9ee', 'Date', - 'Sun, 27 Sep 2020 07:14:25 GMT', + 'Tue, 13 Oct 2020 08:04:09 GMT', 'Content-Length', '0' ]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .delete('/filesystem160119086295008444') + .delete('/filesystem160257624536405504') .query(true) .reply(202, "", [ 'Content-Length', @@ -131,11 +155,11 @@ nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParam 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '395102a8-a01e-001f-499d-94fea4000000', + '5d6cec8b-c01e-007b-1b37-a10f3c000000', 'x-ms-client-request-id', - '43c13ad8-62bd-415f-a6d8-1456e23c2c28', + '13d1f3c8-cf41-463e-80ca-9176150ecf78', 'x-ms-version', '2020-02-10', 'Date', - 'Sun, 27 Sep 2020 07:14:25 GMT' + 'Tue, 13 Oct 2020 08:04:10 GMT' ]); diff --git a/sdk/storage/storage-file-datalake/recordings/node/shared_access_signature_sas_generation_nodejs_only/recording_generateuserdelegationsas_should_work_for_file_for_20191212.js b/sdk/storage/storage-file-datalake/recordings/node/shared_access_signature_sas_generation_nodejs_only/recording_generateuserdelegationsas_should_work_for_file_for_20191212.js new file mode 100644 index 000000000000..21c2ba0de45f --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/node/shared_access_signature_sas_generation_nodejs_only/recording_generateuserdelegationsas_should_work_for_file_for_20191212.js @@ -0,0 +1,168 @@ +let nock = require('nock'); + +module.exports.hash = "0b07d2158d3dc30decd63a5cbc3f0ed9"; + +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem160257605523209248","file":"file160257605617405034"},"newDate":{"now":"2020-10-13T08:00:53.503Z","tmr":"2020-10-13T08:00:53.504Z"}} + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .post('/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', "response_type=token&grant_type=client_credentials&client_id=ff2898b4-369c-47c3-a476-f45ffc9064ef&client_secret=kFm4Gh3r_3ZXon03pcLz10_.X-.5mKFKrf&scope=https%3A%2F%2Fstorage.azure.com%2F.default") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCIsImtpZCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCJ9.eyJhdWQiOiJodHRwczovL3N0b3JhZ2UuYXp1cmUuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3LyIsImlhdCI6MTYwMjU3NTc1MywibmJmIjoxNjAyNTc1NzUzLCJleHAiOjE2MDI2NjI0NTMsImFpbyI6IkUyUmdZT0Q1dW5PeXdLSlhHK2F0ZlNGZ0V2bkhHQUE9IiwiYXBwaWQiOiJmZjI4OThiNC0zNjljLTQ3YzMtYTQ3Ni1mNDVmZmM5MDY0ZWYiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDcvIiwib2lkIjoiMWNlMTMyNzgtYTA4My00ZDE1LTg3OTYtZGUzOTcxNzc5M2UxIiwicmgiOiIwLkFRRUF2NGo1Y3ZHR3IwR1JxeTE4MEJIYlI3U1lLUC1jTnNOSHBIYjBYX3lRWk84YUFBQS4iLCJzdWIiOiIxY2UxMzI3OC1hMDgzLTRkMTUtODc5Ni1kZTM5NzE3NzkzZTEiLCJ0aWQiOiI3MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDciLCJ1dGkiOiJrOUcwSUtBVVQwYW9BVWxzNmZNQ0FBIiwidmVyIjoiMS4wIn0.VwL8TKBCtqGAiYQPCssdTa9eqXPN48WNSGx5APRDOKhm8Ki5beLu1Fff5mpYhnbbLn3Plfn6R9_VqUl2DLzR3aKj7GrcoDcd68VC3NpRn84Rn1wV5_Jb8-FTq-9zVz6YVsu5hCPuZOJEME9iV9ascqWXPYB_BPVbwaF5QRhzS3XorW6pMXg2d8xuclY1F8ZRYGlBpbUXdpMHa1Jih6YiieGFtk3o0L1L0sdDBFWE-83SYsnjJ73-O5p3kf1bbqS7_YRI5LHP0avicmdFeXpGXG-Rtm-cILe1OueOPV-VYddgLUQJk1TM_YCNMSiyJu6IBmkW_dKL1Q2WX67zOYd0wQ"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '20b4d193-14a0-464f-a801-496ce9f30200', + 'x-ms-ests-server', + '2.1.11154.7 - SEASLR1 ProdSlices', + 'Set-Cookie', + 'fpc=AlMaGnkay09Fq59lsu3DNHd00ISJAQAAALVVF9cOAAAA; expires=Thu, 12-Nov-2020 08:00:53 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 13 Oct 2020 08:00:53 GMT', + 'Content-Length', + '1318' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .post('/', "2020-10-13T07:00:53Z2020-10-18T08:00:53Z") + .query(true) + .reply(200, "1ce13278-a083-4d15-8796-de39717793e172f988bf-86f1-41af-91ab-2d7cd011db472020-10-13T07:00:53Z2020-10-18T08:00:53Zb2020-02-10InLBFynMJX84IpyoCRKcHdhVwUCvBEDnoeiSCO0fHtU=", [ + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '022f1da8-901e-003b-5936-a10804000000', + 'x-ms-client-request-id', + '90dd4821-338f-4222-b139-6c6fad073ae7', + 'x-ms-version', + '2020-02-10', + 'Date', + 'Tue, 13 Oct 2020 08:00:54 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem160257605523209248') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Tue, 13 Oct 2020 08:00:55 GMT', + 'ETag', + '"0x8D86F4E1CE68735"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '022f1db7-901e-003b-6036-a10804000000', + 'x-ms-client-request-id', + '6540638c-db85-4d6a-918c-16c959d9524f', + 'x-ms-version', + '2020-02-10', + 'Date', + 'Tue, 13 Oct 2020 08:00:55 GMT' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem160257605523209248/file160257605617405034') + .query(true) + .reply(201, "", [ + 'Last-Modified', + 'Tue, 13 Oct 2020 08:00:57 GMT', + 'ETag', + '"0x8D86F4E1DDB5568"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '0c576e6a-d01f-003a-3b36-a157d8000000', + 'x-ms-version', + '2020-02-10', + 'x-ms-client-request-id', + '8f768392-c627-4ecc-be97-977c1282bfe8', + 'Date', + 'Tue, 13 Oct 2020 08:00:56 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .head('/filesystem160257605523209248/file160257605617405034') + .query(true) + .reply(200, [], [ + 'Cache-Control', + 'cache-control-override', + 'Content-Length', + '0', + 'Content-Type', + 'content-type-override', + 'Content-Encoding', + 'content-encoding-override', + 'Content-Language', + 'content-language-override', + 'Last-Modified', + 'Tue, 13 Oct 2020 08:00:57 GMT', + 'Accept-Ranges', + 'bytes', + 'ETag', + '"0x8D86F4E1DDB5568"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '022f1e0f-901e-003b-1536-a10804000000', + 'x-ms-client-request-id', + 'c4c8beec-43df-4027-83a0-7455f909b015', + 'x-ms-version', + '2020-02-10', + 'x-ms-creation-time', + 'Tue, 13 Oct 2020 08:00:57 GMT', + 'x-ms-lease-status', + 'unlocked', + 'x-ms-lease-state', + 'available', + 'x-ms-blob-type', + 'BlockBlob', + 'Content-Disposition', + 'content-disposition-override', + 'x-ms-server-encrypted', + 'true', + 'x-ms-access-tier', + 'Hot', + 'x-ms-access-tier-inferred', + 'true', + 'Date', + 'Tue, 13 Oct 2020 08:00:56 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem160257605523209248') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '022f1e2a-901e-003b-2736-a10804000000', + 'x-ms-client-request-id', + '8836b7f6-5788-4c1c-bc0a-0d1580a9a860', + 'x-ms-version', + '2020-02-10', + 'Date', + 'Tue, 13 Oct 2020 08:00:57 GMT' +]); diff --git a/sdk/storage/storage-file-datalake/src/sas/DataLakeSASSignatureValues.ts b/sdk/storage/storage-file-datalake/src/sas/DataLakeSASSignatureValues.ts index e986051cad7e..ad7a0c703bd8 100644 --- a/sdk/storage/storage-file-datalake/src/sas/DataLakeSASSignatureValues.ts +++ b/sdk/storage/storage-file-datalake/src/sas/DataLakeSASSignatureValues.ts @@ -330,10 +330,18 @@ export function generateDataLakeSASQueryParameters( sharedKeyCredential ); } else { - return generateBlobSASQueryParametersUDK20181109( - dataLakeSASSignatureValues, - userDelegationKeyCredential! - ); + // Version 2020-02-10 delegation SAS signature construction includes preauthorizedAgentObjectId, agentObjectId, correlationId. + if (version >= "2020-02-10") { + return generateBlobSASQueryParametersUDK20200210( + dataLakeSASSignatureValues, + userDelegationKeyCredential! + ); + } else { + return generateBlobSASQueryParametersUDK20181109( + dataLakeSASSignatureValues, + userDelegationKeyCredential! + ); + } } } @@ -389,11 +397,6 @@ function generateBlobSASQueryParameters20150405( : SERVICE_VERSION; let resource: string = "c"; let verifiedPermissions: string | undefined; - - if (dataLakeSASSignatureValues.snapshotTime) { - throw RangeError("'version' must be >= '2018-11-09' when provided 'snapshotTime'."); - } - dataLakeSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill( dataLakeSASSignatureValues, version @@ -499,13 +502,6 @@ function generateBlobSASQueryParameters20181109( let resource: string = "c"; let verifiedPermissions: string | undefined; - if ( - dataLakeSASSignatureValues.pathName === undefined && - dataLakeSASSignatureValues.snapshotTime - ) { - throw RangeError("Must provide 'blobName' when provided 'snapshotTime'."); - } - dataLakeSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill( dataLakeSASSignatureValues, version @@ -595,7 +591,7 @@ function generateBlobSASQueryParameters20181109( * Creates an instance of SASQueryParameters. * * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn and identifier. + * set corresponding properties directly, such as permissions, startsOn. * * WARNING: identifier will be ignored, permissions and expiresOn are required. * @@ -618,14 +614,128 @@ function generateBlobSASQueryParametersUDK20181109( : SERVICE_VERSION; let resource: string = "c"; let verifiedPermissions: string | undefined; + dataLakeSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill( + dataLakeSASSignatureValues, + version + ); - if ( - dataLakeSASSignatureValues.pathName === undefined && - dataLakeSASSignatureValues.snapshotTime - ) { - throw RangeError("Must provide 'blobName' when provided 'snapshotTime'."); + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + if (dataLakeSASSignatureValues.permissions) { + if (dataLakeSASSignatureValues.pathName) { + if (dataLakeSASSignatureValues.isDirectory) { + verifiedPermissions = DirectorySASPermissions.parse( + dataLakeSASSignatureValues.permissions.toString() + ).toString(); + resource = "d"; + } else { + verifiedPermissions = DataLakeSASPermissions.parse( + dataLakeSASSignatureValues.permissions.toString() + ).toString(); + resource = "b"; + if (dataLakeSASSignatureValues.snapshotTime) { + resource = "bs"; + } + } + } else { + verifiedPermissions = FileSystemSASPermissions.parse( + dataLakeSASSignatureValues.permissions.toString() + ).toString(); + } + } + + // Signature is generated on the un-url-encoded values. + const stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + dataLakeSASSignatureValues.startsOn + ? truncatedISO8061Date(dataLakeSASSignatureValues.startsOn, false) + : "", + dataLakeSASSignatureValues.expiresOn + ? truncatedISO8061Date(dataLakeSASSignatureValues.expiresOn, false) + : "", + getCanonicalName( + userDelegationKeyCredential.accountName, + dataLakeSASSignatureValues.fileSystemName, + dataLakeSASSignatureValues.pathName + ), + userDelegationKeyCredential.userDelegationKey.signedObjectId, + userDelegationKeyCredential.userDelegationKey.signedTenantId, + userDelegationKeyCredential.userDelegationKey.signedStartsOn + ? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedExpiresOn + ? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedService, + userDelegationKeyCredential.userDelegationKey.signedVersion, + dataLakeSASSignatureValues.ipRange ? ipRangeToString(dataLakeSASSignatureValues.ipRange) : "", + dataLakeSASSignatureValues.protocol ? dataLakeSASSignatureValues.protocol : "", + version, + resource, + dataLakeSASSignatureValues.snapshotTime, + dataLakeSASSignatureValues.cacheControl, + dataLakeSASSignatureValues.contentDisposition, + dataLakeSASSignatureValues.contentEncoding, + dataLakeSASSignatureValues.contentLanguage, + dataLakeSASSignatureValues.contentType + ].join("\n"); + + const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); + + return new SASQueryParameters( + version, + signature, + verifiedPermissions, + undefined, + undefined, + dataLakeSASSignatureValues.protocol, + dataLakeSASSignatureValues.startsOn, + dataLakeSASSignatureValues.expiresOn, + dataLakeSASSignatureValues.ipRange, + dataLakeSASSignatureValues.identifier, + resource, + dataLakeSASSignatureValues.cacheControl, + dataLakeSASSignatureValues.contentDisposition, + dataLakeSASSignatureValues.contentEncoding, + dataLakeSASSignatureValues.contentLanguage, + dataLakeSASSignatureValues.contentType, + userDelegationKeyCredential.userDelegationKey, + dataLakeSASSignatureValues.directoryDepth, + dataLakeSASSignatureValues.preauthorizedAgentObjectId, + dataLakeSASSignatureValues.agentObjectId, + dataLakeSASSignatureValues.correlationId + ); +} + +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2020-02-10. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn. + * + * WARNING: identifier will be ignored, permissions and expiresOn are required. + * + * @param {DataLakeSASSignatureValues} dataLakeSASSignatureValues + * @param {UserDelegationKeyCredential} userDelegationKeyCredential + * @returns {SASQueryParameters} + */ +function generateBlobSASQueryParametersUDK20200210( + dataLakeSASSignatureValues: DataLakeSASSignatureValues, + userDelegationKeyCredential: UserDelegationKeyCredential +): SASQueryParameters { + if (!dataLakeSASSignatureValues.permissions || !dataLakeSASSignatureValues.expiresOn) { + throw new RangeError( + "Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS." + ); } + const version = dataLakeSASSignatureValues.version + ? dataLakeSASSignatureValues.version + : SERVICE_VERSION; + let resource: string = "c"; + let verifiedPermissions: string | undefined; dataLakeSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill( dataLakeSASSignatureValues, version @@ -795,5 +905,15 @@ function SASSignatureValuesSanityCheckAndAutofill( ); } + if (dataLakeSASSignatureValues.snapshotTime && version < "2018-11-09") { + throw RangeError("'version' must be >= '2018-11-09' when provided 'snapshotTime'."); + } + if ( + dataLakeSASSignatureValues.pathName === undefined && + dataLakeSASSignatureValues.snapshotTime + ) { + throw RangeError("Must provide 'blobName' when provided 'snapshotTime'."); + } + return dataLakeSASSignatureValues; } diff --git a/sdk/storage/storage-file-datalake/test/node/sas.spec.ts b/sdk/storage/storage-file-datalake/test/node/sas.spec.ts index eb7dd7f59264..9b397f48aa11 100644 --- a/sdk/storage/storage-file-datalake/test/node/sas.spec.ts +++ b/sdk/storage/storage-file-datalake/test/node/sas.spec.ts @@ -24,7 +24,7 @@ import { DataLakeFileClient } from "../../src/"; import { SASProtocol } from "../../src/sas/SASQueryParameters"; import { getDataLakeServiceClient, - getTokenDataLakeServiceClient, + getDataLakeServiceClientWithDefaultCredential, recorderEnvSetup } from "../utils"; @@ -444,11 +444,11 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { }); it("GenerateUserDelegationSAS should work for filesystem with all configurations", async function() { - // Try to get DataLakeServiceClient object with TokenCredential - // when DFS_ACCOUNT_TOKEN environment variable is set + // Try to get DataLakeServiceClient object with DefaultCredential + // when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET environment variable is set let serviceClientWithToken: DataLakeServiceClient | undefined; try { - serviceClientWithToken = getTokenDataLakeServiceClient(); + serviceClientWithToken = getDataLakeServiceClientWithDefaultCredential(); } catch {} // Requires bearer token for this case which cannot be generated in the runtime @@ -502,11 +502,11 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { }); it("GenerateUserDelegationSAS should work for filesystem with minimum parameters", async function() { - // Try to get DataLakeServiceClient object with TokenCredential - // when DFS_ACCOUNT_TOKEN environment variable is set + // Try to get DataLakeServiceClient object with DefaultCredential + // when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET environment variable is set let serviceClientWithToken: DataLakeServiceClient | undefined; try { - serviceClientWithToken = getTokenDataLakeServiceClient(); + serviceClientWithToken = getDataLakeServiceClientWithDefaultCredential(); } catch {} // Requires bearer token for this case which cannot be generated in the runtime @@ -556,11 +556,11 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { }); it("GenerateUserDelegationSAS should work for file", async function() { - // Try to get serviceClient object with TokenCredential - // when DFS_ACCOUNT_TOKEN environment variable is set + // Try to get serviceClient object with DefaultCredential + // when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET environment variable is set let serviceClientWithToken: DataLakeServiceClient | undefined; try { - serviceClientWithToken = getTokenDataLakeServiceClient(); + serviceClientWithToken = getDataLakeServiceClientWithDefaultCredential(); } catch {} // Requires bearer token for this case which cannot be generated in the runtime @@ -627,6 +627,79 @@ describe("Shared Access Signature (SAS) generation Node.js only", () => { await fileSystemClient.delete(); }); + it("GenerateUserDelegationSAS should work for file for 2019-12-12", async function() { + // Try to get serviceClient object with DefaultCredential + // when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET environment variable is set + let serviceClientWithToken: DataLakeServiceClient | undefined; + try { + serviceClientWithToken = getDataLakeServiceClientWithDefaultCredential(); + } catch {} + + // Requires bearer token for this case which cannot be generated in the runtime + // Make sure this case passed in sanity test + if (serviceClientWithToken === undefined) { + this.skip(); + } + + const now = recorder.newDate("now"); + now.setHours(now.getHours() - 1); + const tmr = recorder.newDate("tmr"); + tmr.setDate(tmr.getDate() + 5); + const userDelegationKey = await serviceClientWithToken!.getUserDelegationKey(now, tmr); + + // By default, credential is always the last element of pipeline factories + const factories = (serviceClient as any).pipeline.factories; + const sharedKeyCredential = factories[factories.length - 1] as StorageSharedKeyCredential; + const accountName = sharedKeyCredential.accountName; + + const fileSystemName = recorder.getUniqueName("filesystem"); + const fileSystemClient = serviceClient.getFileSystemClient(fileSystemName); + await fileSystemClient.create(); + + const fileName = recorder.getUniqueName("file"); + const fileClient = fileSystemClient.getFileClient(fileName); + await fileClient.create({ + pathHttpHeaders: { + contentType: "content-type-original" + } + }); + + const fileSAS = generateDataLakeSASQueryParameters( + { + pathName: fileClient.name, + cacheControl: "cache-control-override", + fileSystemName: fileClient.fileSystemName, + contentDisposition: "content-disposition-override", + contentEncoding: "content-encoding-override", + contentLanguage: "content-language-override", + contentType: "content-type-override", + expiresOn: tmr, + ipRange: { start: "0.0.0.0", end: "255.255.255.255" }, + permissions: DataLakeSASPermissions.parse("racwd"), + protocol: SASProtocol.HttpsAndHttp, + startsOn: now, + version: "2019-12-12" + }, + userDelegationKey, + accountName + ); + + const sasClient = `${fileClient.url}?${fileSAS}`; + const fileClientWithSAS = new DataLakeFileClient( + sasClient, + newPipeline(new AnonymousCredential()) + ); + + const properties = await fileClientWithSAS.getProperties(); + assert.equal(properties.cacheControl, "cache-control-override"); + assert.equal(properties.contentDisposition, "content-disposition-override"); + assert.equal(properties.contentEncoding, "content-encoding-override"); + assert.equal(properties.contentLanguage, "content-language-override"); + assert.equal(properties.contentType, "content-type-override"); + + await fileSystemClient.delete(); + }); + it("construct SASQueryParameters with a option bag", async () => { // no option and optional parameters const sasQP = new SASQueryParameters("2020-02-10", "signature"); @@ -743,7 +816,7 @@ describe("SAS generation Node.js only for directory SAS", () => { directoryDepth: 1, expiresOn: tmr, ipRange: { start: "0.0.0.0", end: "255.255.255.255" }, - permissions: FileSystemSASPermissions.parse("racwdlmeop"), + permissions: DataLakeSASPermissions.parse("racwdmeop"), protocol: SASProtocol.HttpsAndHttp, startsOn: now, version: "2020-02-10" @@ -826,6 +899,10 @@ describe("SAS generation Node.js only for directory SAS", () => { newPipeline(new AnonymousCredential()) ); + // o + const guid = "b77d5205-ddb5-42e1-80ee-26c74a5e9333"; + await fileClientWithSAS.setAccessControl([], { owner: guid }); + // e await fileClientWithSAS.getAccessControl(); @@ -895,7 +972,7 @@ describe("SAS generation Node.js only for delegation SAS", () => { recorder = record(this, recorderEnvSetup); accountName = process.env["DFS_ACCOUNT_NAME"] || ""; try { - oauthServiceClient = getTokenDataLakeServiceClient(); + oauthServiceClient = getDataLakeServiceClientWithDefaultCredential(); } catch (err) { console.log(err); this.skip(); @@ -934,7 +1011,7 @@ describe("SAS generation Node.js only for delegation SAS", () => { pathName: directoryClient.name, isDirectory: true, expiresOn: tmr, - permissions: FileSystemSASPermissions.parse("racwdlmeop") + permissions: DataLakeSASPermissions.parse("racwdmeop") }, userDelegationKey, accountName @@ -979,9 +1056,7 @@ describe("SAS generation Node.js only for delegation SAS", () => { const newFileName = recorder.getUniqueName("newFile"); const newFileClient = fileSystemClient.getFileClient(newFileName); - const newFileClientWithSAS = new DataLakeDirectoryClient( - `${newFileClient.url}?${fileSystemSAS}` - ); + const newFileClientWithSAS = new DataLakeFileClient(`${newFileClient.url}?${fileSystemSAS}`); await newFileClientWithSAS.createIfNotExists(); const unauthoriziedGuid = "7d53815c-1b73-49ab-b44d-002bfb890633"; @@ -998,9 +1073,7 @@ describe("SAS generation Node.js only for delegation SAS", () => { accountName ); - const newFileClientWithSAS2 = new DataLakeDirectoryClient( - `${newFileClient.url}?${fileSystemSAS2}` - ); + const newFileClientWithSAS2 = new DataLakeFileClient(`${newFileClient.url}?${fileSystemSAS2}`); try { await newFileClientWithSAS2.createIfNotExists(); } catch (err) { @@ -1018,9 +1091,7 @@ describe("SAS generation Node.js only for delegation SAS", () => { userDelegationKey, accountName ); - const newFileClientWithSAS3 = new DataLakeDirectoryClient( - `${newFileClient.url}?${fileSystemSAS3}` - ); + const newFileClientWithSAS3 = new DataLakeFileClient(`${newFileClient.url}?${fileSystemSAS3}`); await newFileClientWithSAS3.createIfNotExists(); }); diff --git a/sdk/storage/storage-file-datalake/test/utils/index.ts b/sdk/storage/storage-file-datalake/test/utils/index.ts index ef3bd396e2f3..3914c8b2ea6f 100644 --- a/sdk/storage/storage-file-datalake/test/utils/index.ts +++ b/sdk/storage/storage-file-datalake/test/utils/index.ts @@ -99,13 +99,16 @@ export function getDataLakeServiceClient( return getGenericDataLakeServiceClient("DFS_", undefined, pipelineOptions); } -export function getDataLakeServiceClientWithDefualtCredential( +export function getDataLakeServiceClientWithDefaultCredential( accountType: string = "DFS_", pipelineOptions: StoragePipelineOptions = {}, accountNameSuffix: string = "" ): DataLakeServiceClient { const accountNameEnvVar = `${accountType}ACCOUNT_NAME`; let accountName = process.env[accountNameEnvVar]; + if (!accountName || accountName === "") { + throw new Error(`${accountNameEnvVar} environment variables not specified.`); + } const credential = new DefaultAzureCredential(); const pipeline = newPipeline(credential, { diff --git a/sdk/storage/storage-file-datalake/tests.yml b/sdk/storage/storage-file-datalake/tests.yml index edda42c7d06a..96b671a47d93 100644 --- a/sdk/storage/storage-file-datalake/tests.yml +++ b/sdk/storage/storage-file-datalake/tests.yml @@ -7,6 +7,7 @@ extends: ResourceServiceDirectory: storage TimeoutInMinutes: 90 ResourceGroupLocation: canadacentral + SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview) EnvVars: AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) diff --git a/sdk/storage/storage-file-share/test/fileclient.spec.ts b/sdk/storage/storage-file-share/test/fileclient.spec.ts index 2078da385fc0..544d5153c19d 100644 --- a/sdk/storage/storage-file-share/test/fileclient.spec.ts +++ b/sdk/storage/storage-file-share/test/fileclient.spec.ts @@ -4,7 +4,7 @@ import * as dotenv from "dotenv"; import { AbortController } from "@azure/abort-controller"; import { isNode, URLBuilder, URLQuery } from "@azure/core-http"; import { setTracer, SpanGraph, TestTracer } from "@azure/core-tracing"; -import { delay, record, Recorder } from "@azure/test-utils-recorder"; +import { delay, isLiveMode, record, Recorder } from "@azure/test-utils-recorder"; import { FileStartCopyOptions, ShareClient, ShareDirectoryClient, ShareFileClient } from "../src"; import { FileSystemAttributes } from "../src/FileSystemAttributes"; @@ -556,7 +556,11 @@ describe("FileClient", () => { assert.deepStrictEqual(result.rangeList[0], { start: 512, end: 512 }); }); - it("getRangeListDiff", async () => { + it("getRangeListDiff", async function() { + if (isLiveMode()) { + // Skipped for now as the result is not stable. + this.skip(); + } await fileClient.create(512 * 4 + 1); await fileClient.uploadRange("Hello", 0, 5); @@ -567,6 +571,10 @@ describe("FileClient", () => { await fileClient.uploadRange("World", 1023, 5); const result = await fileClient.getRangeListDiff(snapshotRes.snapshot!); + console.log(result.clearRanges); + console.log(result.ranges); + console.log(result.requestId); + assert.ok(result.clearRanges); assert.deepStrictEqual(result.clearRanges!.length, 1); assert.deepStrictEqual(result.clearRanges![0], { start: 0, end: 511 }); @@ -576,7 +584,11 @@ describe("FileClient", () => { assert.deepStrictEqual(result.ranges![0], { start: 512, end: 1535 }); }); - it("getRangeListDiff with share snapshot", async () => { + it("getRangeListDiff with share snapshot", async function() { + if (isLiveMode()) { + // Skipped for now as the result is not stable. + this.skip(); + } await fileClient.create(512 * 4 + 1); await fileClient.uploadRange("Hello", 0, 5); @@ -593,6 +605,9 @@ describe("FileClient", () => { const fileClientWithShareSnapShot = fileClient.withShareSnapshot(snapshotRes2.snapshot!); const result = await fileClientWithShareSnapShot.getRangeListDiff(snapshotRes.snapshot!); + console.log(result.clearRanges); + console.log(result.ranges); + console.log(result.requestId); assert.ok(result.clearRanges); assert.deepStrictEqual(result.clearRanges!.length, 1); diff --git a/sdk/storage/storage-file-share/test/fileserviceclient.spec.ts b/sdk/storage/storage-file-share/test/fileserviceclient.spec.ts index 92270337ea90..439d4636a33b 100644 --- a/sdk/storage/storage-file-share/test/fileserviceclient.spec.ts +++ b/sdk/storage/storage-file-share/test/fileserviceclient.spec.ts @@ -7,7 +7,7 @@ import { getSoftDeleteBSU, getGenericBSU } from "./utils"; -import { record, delay, Recorder } from "@azure/test-utils-recorder"; +import { record, delay, Recorder, isLiveMode } from "@azure/test-utils-recorder"; import * as dotenv from "dotenv"; import { ShareServiceClient, ShareItem } from "../src"; dotenv.config(); @@ -492,7 +492,11 @@ describe("FileServiceClient Premium", () => { await recorder.stop(); }); - it("SMB Multichannel", async () => { + it("SMB Multichannel", async function() { + if (isLiveMode()) { + // Skipped for now as it needs be enabled on the account. + this.skip(); + } await serviceClient.setProperties({ protocol: { smb: { multichannel: { enabled: true } } } }); diff --git a/sdk/storage/storage-file-share/tests.yml b/sdk/storage/storage-file-share/tests.yml index adb6bce8f675..f674802b22b2 100644 --- a/sdk/storage/storage-file-share/tests.yml +++ b/sdk/storage/storage-file-share/tests.yml @@ -6,6 +6,8 @@ extends: PackageName: "@azure/storage-file-share" ResourceServiceDirectory: storage TimeoutInMinutes: 90 + ResourceGroupLocation: canadacentral + SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview) EnvVars: AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) diff --git a/sdk/storage/storage-queue/tests.yml b/sdk/storage/storage-queue/tests.yml index 8fd7a8bc31f4..c32dceb5f56d 100644 --- a/sdk/storage/storage-queue/tests.yml +++ b/sdk/storage/storage-queue/tests.yml @@ -5,3 +5,5 @@ extends: parameters: PackageName: "@azure/storage-queue" ResourceServiceDirectory: storage + ResourceGroupLocation: canadacentral + SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview) diff --git a/sdk/storage/test-resources-post.ps1 b/sdk/storage/test-resources-post.ps1 index c2604c770827..3e61bc86c32d 100644 --- a/sdk/storage/test-resources-post.ps1 +++ b/sdk/storage/test-resources-post.ps1 @@ -62,6 +62,12 @@ $storageContext = New-AzStorageContext -StorageAccountName $datalakeStorageAccou $storageSas = New-AzStorageAccountSASToken -ResourceType Service, Container, Object -Service Blob, File, Queue, Table -Permission "rwdxftlacup" -Context $storageContext $AdditionalEnvKeys["DFS_ACCOUNT_SAS"] = $storageSas +$fullStorageAccount = $DeploymentOutputs['FULL_ACCOUNT_NAME'] +Write-Host "Creating SAS for full storage account $fullStorageAccount" +$storageContext = New-AzStorageContext -StorageAccountName $fullStorageAccount -StorageAccountKey $DeploymentOutputs['FULL_ACCOUNT_KEY'] +$storageSas = New-AzStorageAccountSASToken -ResourceType Service, Container, Object -Service Blob, File, Queue, Table -Permission "rwdxftlacup" -Context $storageContext +$AdditionalEnvKeys["FULL_ACCOUNT_SAS"] = $storageSas +$AdditionalEnvKeys["SOFT_DELETE_ACCOUNT_SAS"] = $storageSas # Try to detect the shell based on the parent process name (e.g. launch via shebang). $shell, $shellExportFormat = if (($parentProcessName = (Get-Process -Id $PID).Parent.ProcessName) -and $parentProcessName -eq 'cmd') { diff --git a/sdk/storage/test-resources.json b/sdk/storage/test-resources.json index 9fa750ddbf86..184d91d5aebe 100644 --- a/sdk/storage/test-resources.json +++ b/sdk/storage/test-resources.json @@ -32,8 +32,8 @@ "metadata": { "description": "The application client secret used to run tests." } - }, - "enableVersioning": { + }, + "enableVersioning": { "type": "bool", "defaultValue": false }, @@ -49,9 +49,13 @@ "storageApiVersion": "2019-04-01", "location": "[resourceGroup().location]", "accountName": "[parameters('baseName')]", - "datalakeAccountName": "[concat('d', parameters('baseName'))]", + "datalakeAccountName": "[concat('dl', parameters('baseName'))]", + "fullAccountName": "[concat('f', parameters('baseName'))]", + "premiumFileAccountName": "[concat('pf', parameters('baseName'))]", "accountNameTidy": "[toLower(trim(variables('accountName')))]", - "datalakeaccountNameTidy": "[toLower(trim(variables('datalakeAccountName')))]", + "datalakeAccountNameTidy": "[toLower(trim(variables('datalakeAccountName')))]", + "fullAccountNameTidy": "[toLower(trim(variables('fullAccountName')))]", + "premiumFileAccountNameTidy": "[toLower(trim(variables('premiumFileAccountName')))]", "blobEndPoint": "[concat('https://',variables('accountNameTidy'),'.blob.', parameters('storageEndpointSuffix'))]", "accountSasProperties": { "signedServices": "bfqt", @@ -61,21 +65,47 @@ "signedExpiry": "2022-01-01T23:59:00Z" }, "authorizationApiVersion": "2018-01-01-preview", - "blobDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe')]" + "blobDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", + "blobDataOwnerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/b7e6dc6d-f1e8-4753-8033-0f276bb0955b')]", + "encryption": { + "services": { + "file": { + "enabled": true + }, + "blob": { + "enabled": true + } + }, + "keySource": "Microsoft.Storage" + }, + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" + } }, "resources": [ { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "[variables('authorizationApiVersion')]", "name": "[guid(concat('blobDataContributorRoleId', variables('accountName')))]", - "dependsOn": [ - "[variables('accountName')]" - ], + "dependsOn": ["[variables('accountName')]"], "properties": { "roleDefinitionId": "[variables('blobDataContributorRoleId')]", "principalId": "[parameters('testApplicationOid')]" } }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "[variables('authorizationApiVersion')]", + "name": "[guid(concat('blobDataOwnerRoleId', variables('accountName')))]", + "dependsOn": ["[variables('accountName')]"], + "properties": { + "roleDefinitionId": "[variables('blobDataOwnerRoleId')]", + "principalId": "[parameters('testApplicationOid')]" + } + }, { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "[variables('storageApiVersion')]", @@ -87,26 +117,9 @@ }, "kind": "StorageV2", "properties": { - "networkAcls": { - "bypass": "AzureServices", - "virtualNetworkRules": [ - ], - "ipRules": [ - ], - "defaultAction": "Allow" - }, + "networkAcls": "[variables('networkAcls')]", "supportsHttpsTrafficOnly": true, - "encryption": { - "services": { - "file": { - "enabled": true - }, - "blob": { - "enabled": true - } - }, - "keySource": "Microsoft.Storage" - }, + "encryption": "[variables('encryption')]", "accessTier": "Hot" }, "resources": [ @@ -114,17 +127,13 @@ "name": "default", "type": "blobServices", "apiVersion": "[variables('storageApiVersion')]", - "dependsOn": [ - "[variables('accountName')]" - ], + "dependsOn": ["[variables('accountName')]"], "properties": { "isVersioningEnabled": "[parameters('enableVersioning')]", "cors": { "corsRules": [ { - "allowedOrigins": [ - "*" - ], + "allowedOrigins": ["*"], "allowedMethods": [ "DELETE", "GET", @@ -136,57 +145,40 @@ "PATCH" ], "maxAgeInSeconds": 86400, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] + "exposedHeaders": ["*"], + "allowedHeaders": ["*"] } ] + }, + "lastAccessTimeTrackingPolicy": { + "enable": true, + "name": "AccessTimeTracking", + "trackingGranularityInDays": 1, + "blobType": ["blockBlob"] } }, - "resources": [ - ] + "resources": [] }, { "name": "default", "type": "fileServices", "apiVersion": "[variables('storageApiVersion')]", - "dependsOn": [ - "[variables('accountName')]" - ], + "dependsOn": ["[variables('accountName')]"], "properties": { "cors": { "corsRules": [ { - "allowedOrigins": [ - "*" - ], - "allowedMethods": [ - "DELETE", - "GET", - "HEAD", - "MERGE", - "POST", - "OPTIONS", - "PUT" - ], + "allowedOrigins": ["*"], + "allowedMethods": ["DELETE", "GET", "HEAD", "MERGE", "POST", "OPTIONS", "PUT"], "maxAgeInSeconds": 86400, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] + "exposedHeaders": ["*"], + "allowedHeaders": ["*"] } ] } }, - "resources": [ - ] + "resources": [] } - ] }, { @@ -201,54 +193,135 @@ "kind": "StorageV2", "properties": { "isHnsEnabled": true, - "cors": { - "corsRules": [ - { - "allowedOrigins": [ - "*" - ], - "allowedMethods": [ - "DELETE", - "GET", - "HEAD", - "MERGE", - "POST", - "OPTIONS", - "PUT", - "PATCH" - ], - "maxAgeInSeconds": 86400, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - } - ] - }, - "networkAcls": { - "bypass": "AzureServices", - "virtualNetworkRules": [ - ], - "ipRules": [ - ], - "defaultAction": "Allow" - }, + "networkAcls": "[variables('networkAcls')]", "supportsHttpsTrafficOnly": true, - "encryption": { - "services": { - "file": { - "enabled": true + "encryption": "[variables('encryption')]", + "accessTier": "Hot" + } + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "[variables('storageApiVersion')]", + "name": "[variables('fullAccountName')]", + "location": "[variables('location')]", + "sku": { + "name": "Standard_RAGRS", + "tier": "Standard" + }, + "kind": "StorageV2", + "properties": { + "networkAcls": "[variables('networkAcls')]", + "supportsHttpsTrafficOnly": true, + "encryption": "[variables('encryption')]", + "accessTier": "Hot" + }, + "resources": [ + { + "name": "default", + "type": "blobServices", + "apiVersion": "[variables('storageApiVersion')]", + "properties": { + "restorePolicy": { + "enabled": true, + "days": 6 + }, + "deleteRetentionPolicy": { + "enabled": true, + "days": 7 }, - "blob": { + "containerDeleteRetentionPolicy": { + "enabled": true, + "days": 7 + }, + "changeFeed": { "enabled": true + }, + "isVersioningEnabled": true, + "cors": { + "corsRules": [ + { + "allowedOrigins": ["*"], + "allowedMethods": [ + "DELETE", + "GET", + "HEAD", + "MERGE", + "POST", + "OPTIONS", + "PUT", + "PATCH" + ], + "maxAgeInSeconds": 86400, + "exposedHeaders": ["*"], + "allowedHeaders": ["*"] + } + ] } }, - "keySource": "Microsoft.Storage" + "dependsOn": ["[variables('fullAccountName')]"] }, + { + "name": "default", + "type": "fileservices", + "apiVersion": "[variables('storageApiVersion')]", + "properties": { + "shareDeleteRetentionPolicy": { + "enabled": true, + "days": 7 + }, + "cors": { + "corsRules": [ + { + "allowedOrigins": ["*"], + "allowedMethods": ["DELETE", "GET", "HEAD", "MERGE", "POST", "OPTIONS", "PUT"], + "maxAgeInSeconds": 86400, + "exposedHeaders": ["*"], + "allowedHeaders": ["*"] + } + ] + } + }, + "dependsOn": ["[variables('fullAccountName')]"] + } + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "[variables('storageApiVersion')]", + "name": "[variables('premiumFileAccountName')]", + "location": "[variables('location')]", + "sku": { + "name": "Premium_LRS", + "tier": "Premium" + }, + "kind": "FileStorage", + "properties": { + "networkAcls": "[variables('networkAcls')]", + "supportsHttpsTrafficOnly": true, + "encryption": "[variables('encryption')]", "accessTier": "Hot" - } + }, + "resources": [ + { + "name": "default", + "type": "fileservices", + "apiVersion": "[variables('storageApiVersion')]", + "properties": { + "cors": { + "corsRules": [ + { + "allowedOrigins": ["*"], + "allowedMethods": ["DELETE", "GET", "HEAD", "MERGE", "POST", "OPTIONS", "PUT"], + "maxAgeInSeconds": 86400, + "exposedHeaders": ["*"], + "allowedHeaders": ["*"] + } + ] + } + }, + "dependsOn": ["[variables('premiumFileAccountName')]"] + } + ] } ], "outputs": { @@ -290,7 +363,55 @@ }, "DFS_ACCOUNT_SAS": { "type": "string", - "value": "[concat('?', listAccountSas(variables('datalakeaccountNameTidy'), variables('storageApiVersion'), variables('accountSasProperties')).accountSasToken)]" + "value": "[concat('?', listAccountSas(variables('datalakeAccountNameTidy'), variables('storageApiVersion'), variables('accountSasProperties')).accountSasToken)]" + }, + "FULL_ACCOUNT_NAME": { + "type": "string", + "value": "[variables('fullAccountName')]" + }, + "FULL_ACCOUNT_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('fullAccountName')), variables('storageApiVersion')).keys[0].value]" + }, + "FULL_ACCOUNT_SAS": { + "type": "string", + "value": "[concat('?', listAccountSas(variables('fullAccountNameTidy'), variables('storageApiVersion'), variables('accountSasProperties')).accountSasToken)]" + }, + "FULL_STORAGE_CONNECTION_STRING": { + "type": "string", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('fullAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('fullAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" + }, + "SOFT_DELETE_ACCOUNT_NAME": { + "type": "string", + "value": "[variables('fullAccountName')]" + }, + "SOFT_DELETE_ACCOUNT_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('fullAccountName')), variables('storageApiVersion')).keys[0].value]" + }, + "SOFT_DELETE_ACCOUNT_SAS": { + "type": "string", + "value": "[concat('?', listAccountSas(variables('fullAccountNameTidy'), variables('storageApiVersion'), variables('accountSasProperties')).accountSasToken)]" + }, + "SOFT_DELETE_STORAGE_CONNECTION_STRING": { + "type": "string", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('fullAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('fullAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" + }, + "PREMIUM_FILE_ACCOUNT_NAME": { + "type": "string", + "value": "[variables('fullAccountName')]" + }, + "PREMIUM_FILE_ACCOUNT_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('fullAccountName')), variables('storageApiVersion')).keys[0].value]" + }, + "PREMIUM_FILE_ACCOUNT_SAS": { + "type": "string", + "value": "[concat('?', listAccountSas(variables('fullAccountNameTidy'), variables('storageApiVersion'), variables('accountSasProperties')).accountSasToken)]" + }, + "PREMIUM_FILE_STORAGE_CONNECTION_STRING": { + "type": "string", + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('fullAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('fullAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" } } }