From e76302bde2fba6c347ca97dc3392918bdb252e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Thu, 3 Sep 2020 08:47:05 -0400 Subject: [PATCH 01/15] [Key Vault Admin] Tests --- sdk/keyvault/keyvault-admin/package.json | 53 ++++++++++-- .../keyvault-admin/rollup.test.config.js | 6 ++ .../public/accessControlClient.aborts.spec.ts | 82 ++++++++++++++++++ .../test/public/accessControlClient.spec.ts | 84 +++++++++++++++++++ .../test/public/backupClient.abort.spec.ts | 74 ++++++++++++++++ .../test/public/backupClient.spec.ts | 81 ++++++++++++++++++ .../test/utils/authentication.ts | 49 +++++++++++ .../keyvault-admin/test/utils/common.ts | 52 ++++++++++++ .../keyvault-admin/test/utils/recorder.ts | 22 +++++ sdk/keyvault/keyvault-admin/tests.yml | 2 + 10 files changed, 496 insertions(+), 9 deletions(-) create mode 100644 sdk/keyvault/keyvault-admin/rollup.test.config.js create mode 100644 sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts create mode 100644 sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts create mode 100644 sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts create mode 100644 sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts create mode 100644 sdk/keyvault/keyvault-admin/test/utils/authentication.ts create mode 100644 sdk/keyvault/keyvault-admin/test/utils/common.ts create mode 100644 sdk/keyvault/keyvault-admin/test/utils/recorder.ts diff --git a/sdk/keyvault/keyvault-admin/package.json b/sdk/keyvault/keyvault-admin/package.json index b11b1032d16d..6fad55e16cf7 100644 --- a/sdk/keyvault/keyvault-admin/package.json +++ b/sdk/keyvault/keyvault-admin/package.json @@ -20,7 +20,7 @@ "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "main": "./dist/index.js", - "module": "dist-esm/src/index.js", + "module": "dist-esm/keyvault-admin/src/index.js", "types": "./types/keyvault-admin.d.ts", "engine": { "node": ">=8.0.0" @@ -29,10 +29,11 @@ "node": ">=8.0.0" }, "files": [ - "types/", + "types/keyvault-admin.d.ts", "dist/", "dist-browser/", - "dist-esm/src", + "dist-esm/keyvault-admin/src", + "dist-esm/keyvault-common/src", "README.md", "LICENSE" ], @@ -45,20 +46,21 @@ "build:samples": "echo skipped", "build:es6": "tsc -p tsconfig.json", "build:nodebrowser": "rollup -c 2>&1", - "build:test": "echo skipped", + "build:test": "npm run build:es6 && rollup -c rollup.test.config.js 2>&1", "build": "npm run extract-api && npm run build:es6 && npm run build:nodebrowser", "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist dist-esm dist-test types *.tgz *.log dist-browser statistics.html coverage && rimraf src/**/*.js && rimraf test/**/*.js", "execute:js-samples": "echo skipped", "execute:ts-samples": "echo skipped", "execute:samples": "npm run build:samples && npm run execute:js-samples && npm run execute:ts-samples", - "extract-api": "echo skipped", + "extract-api": "tsc -p . && api-extractor run --local", "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "integration-test:browser": "echo skipped", - "integration-test:node": "echo skipped", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/**/*.spec.js", + "integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/**/*.spec.js", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "lint:fix": "eslint package.json src --ext .ts --fix --fix-type [problem,suggestion]", - "lint": "eslint package.json src --ext .ts -f html -o keyvault-admin-lintReport.html", + "lint": "eslint package.json api-extractor.json src --ext .ts", "lint:terminal": "eslint package.json src test --ext .ts", "pack": "npm pack 2>&1", "prebuild": "npm run clean", @@ -72,29 +74,61 @@ }, "sideEffects": false, "dependencies": { + "@azure/abort-controller": "^1.0.0", "@azure/core-http": "^1.1.6", "@azure/core-lro": "^1.0.2", + "@azure/core-paging": "^1.1.1", "@azure/core-tracing": "1.0.0-preview.9", + "@azure/logger": "^1.0.0", "@opentelemetry/api": "^0.10.2", - "tslib": "^2.0.0" + "tslib": "^2.0.0", + "@azure/keyvault-keys": "~4.1.1" }, "devDependencies": { + "@azure/abort-controller": "^1.0.0", + "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^1.1.0", + "@azure/test-utils-recorder": "^1.0.0", + "@microsoft/api-extractor": "7.7.11", "@rollup/plugin-commonjs": "11.0.2", "@rollup/plugin-json": "^4.0.0", "@rollup/plugin-multi-entry": "^3.0.0", "@rollup/plugin-node-resolve": "^8.0.0", "@rollup/plugin-replace": "^2.2.0", + "@types/chai": "^4.1.6", + "@types/fs-extra": "^8.0.0", + "@types/mocha": "^7.0.2", "@types/node": "^8.0.0", + "@types/uuid": "^8.0.0", "@typescript-eslint/eslint-plugin": "^2.0.0", "@typescript-eslint/parser": "^2.0.0", + "assert": "^1.4.1", + "chai": "^4.2.0", "cross-env": "^7.0.2", + "dotenv": "^8.2.0", "eslint": "^6.1.0", "eslint-config-prettier": "^6.0.0", "eslint-plugin-no-null": "^1.0.2", "eslint-plugin-no-only-tests": "^2.3.0", "eslint-plugin-promise": "^4.1.1", "esm": "^3.2.18", + "karma": "^5.1.0", + "karma-chrome-launcher": "^3.0.0", + "karma-coverage": "^2.0.0", + "karma-edge-launcher": "^0.4.2", + "karma-env-preprocessor": "^0.1.1", + "karma-firefox-launcher": "^1.1.0", + "karma-ie-launcher": "^1.0.0", + "karma-json-preprocessor": "^0.3.3", + "karma-json-to-file-reporter": "^1.0.1", + "karma-junit-reporter": "^2.0.1", + "karma-mocha": "^2.0.1", + "karma-mocha-reporter": "^2.2.5", + "karma-remap-istanbul": "^0.6.0", + "mocha": "^7.1.1", + "mocha-junit-reporter": "^1.18.0", + "nyc": "^14.0.0", "prettier": "^1.16.4", "rimraf": "^3.0.0", "rollup": "^1.16.3", @@ -103,6 +137,7 @@ "rollup-plugin-terser": "^5.1.1", "rollup-plugin-visualizer": "^4.0.4", "source-map-support": "^0.5.9", - "typescript": "~3.9.3" + "typescript": "~3.9.3", + "uuid": "^8.1.0" } } diff --git a/sdk/keyvault/keyvault-admin/rollup.test.config.js b/sdk/keyvault/keyvault-admin/rollup.test.config.js new file mode 100644 index 000000000000..ad98718cce46 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/rollup.test.config.js @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import * as base from "./rollup.base.config"; + +export default [base.nodeConfig(true), base.browserConfig(true)]; diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts new file mode 100644 index 000000000000..c9cc9d3f9fc1 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { env, Recorder } from "@azure/test-utils-recorder"; +import { AbortController } from "@azure/abort-controller"; + +import { KeyVaultAccessControlClient } from "../../src"; +import { assertThrowsAbortError } from "../utils/common"; +import { authenticate } from "../utils/authentication"; + +describe("Aborting KeyVaultAccessControlClient's requests", () => { + let client: KeyVaultAccessControlClient; + let recorder: Recorder; + let generateFakeUUID: () => string; + const globalScope = "/"; + + beforeEach(async function() { + const authentication = await authenticate(this); + client = authentication.accessControlClient; + recorder = authentication.recorder; + generateFakeUUID = authentication.generateFakeUUID; + }); + + afterEach(async function() { + await recorder.stop(); + }); + + // The tests follow + + it("can abort listRoleDefinitions", async function() { + const controller = new AbortController(); + controller.abort(); + + await assertThrowsAbortError(async () => { + await client + .listRoleDefinitions("/", { + abortSignal: controller.signal + }) + .next(); + }); + }); + + it("can abort createRoleAssignment", async function() { + const roleDefinitionId = generateFakeUUID(); + const name = generateFakeUUID(); + + const controller = new AbortController(); + controller.abort(); + + await assertThrowsAbortError(async () => { + await client.createRoleAssignment(globalScope, name, roleDefinitionId, env.AZURE_TENANT_ID, { + abortSignal: controller.signal + }); + }); + }); + + it("can abort getRoleAssignment", async function() { + const name = generateFakeUUID(); + + const controller = new AbortController(); + controller.abort(); + + await assertThrowsAbortError(async () => { + await client.getRoleAssignment(globalScope, name, { + abortSignal: controller.signal + }); + }); + }); + + it("can abort deleteRoleAssignment", async function() { + const name = generateFakeUUID(); + + const controller = new AbortController(); + controller.abort(); + + await assertThrowsAbortError(async () => { + await client.deleteRoleAssignment(globalScope, name, { + abortSignal: controller.signal + }); + }); + }); +}); diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts new file mode 100644 index 000000000000..9cf9be0b412b --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { assert } from "chai"; +import { env, Recorder } from "@azure/test-utils-recorder"; + +import { KeyVaultAccessControlClient } from "../../src"; +import { authenticate } from "../utils/authentication"; + +describe("KeyVaultAccessControlClient", () => { + let client: KeyVaultAccessControlClient; + let recorder: Recorder; + let generateFakeUUID: () => string; + const globalScope = "/"; + + beforeEach(async function() { + const authentication = await authenticate(this); + client = authentication.accessControlClient; + recorder = authentication.recorder; + generateFakeUUID = authentication.generateFakeUUID; + }); + + afterEach(async function() { + await recorder.stop(); + }); + + // The tests follow + + it("listRoleDefinitions", async function() { + const expectedType = "Microsoft.Authorization/roleDefinitions"; + let receivedRoles: string[] = []; + + for await (const roleDefinition of client.listRoleDefinitions("/")) { + // Each role definition will have the shape of: + // + // { + // id: 'Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/', + // name: '', + // type: '', + // roleName: '', + // // ... + // } + // + assert.equal(roleDefinition.type, expectedType); + receivedRoles.push(roleDefinition.roleName!); + } + + assert.deepEqual(receivedRoles, [ + "Managed HSM Administrator", + "Managed HSM Crypto Officer", + "Managed HSM Crypto User", + "Managed HSM Policy Administrator", + "Managed HSM Crypto Auditor", + "Managed HSM Crypto Service Encryption", + "Managed HSM Backup" + ]); + }); + + it("createRoleAssignment and deleteRoleAssignment", async function() { + const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; + const name = generateFakeUUID(); + const assignment = await client.createRoleAssignment( + globalScope, + name, + roleDefinition.id!, + env.AZURE_TENANT_ID + ); + assert.equal(assignment.name, name); + assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); + assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); + await client.deleteRoleAssignment(globalScope, name); + }); + + it("createRoleAssignment, getRoleAssignment and deleteRoleAssignment", async function() { + const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; + const name = generateFakeUUID(); + await client.createRoleAssignment(globalScope, name, roleDefinition.id!, env.AZURE_TENANT_ID); + const assignment = await client.getRoleAssignment(globalScope, name); + assert.equal(assignment.name, name); + assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); + assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); + await client.deleteRoleAssignment(globalScope, name); + }); +}); diff --git a/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts b/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts new file mode 100644 index 000000000000..1259f93af8d9 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { env, Recorder } from "@azure/test-utils-recorder"; +import { AbortController } from "@azure/abort-controller"; + +import { KeyVaultBackupClient } from "../../src"; +import { authenticate } from "../utils/authentication"; +import { testPollerProperties } from "../utils/recorder"; +import { assertThrowsAbortError, getFolderName } from "../utils/common"; + +describe("Aborting KeyVaultBackupClient's requests", () => { + let client: KeyVaultBackupClient; + let recorder: Recorder; + + beforeEach(async function() { + const authentication = await authenticate(this); + client = authentication.backupClient; + recorder = authentication.recorder; + }); + + afterEach(async function() { + await recorder.stop(); + }); + + // The tests follow + + it("can abort beginBackup", async function() { + const blobStorageUri = env.BLOB_STORAGE_URI; + const sasToken = env.BLOB_STORAGE_SAS_TOKEN; + + const controller = new AbortController(); + controller.abort(); + + await assertThrowsAbortError(async () => { + await client.beginBackup(blobStorageUri, sasToken, { + ...testPollerProperties, + abortSignal: controller.signal + }); + }); + }); + + it("can abort beginRestore", async function() { + const blobStorageUri = env.BLOB_STORAGE_URI; + const sasToken = env.BLOB_STORAGE_SAS_TOKEN; + const folderName = getFolderName(blobStorageUri); + + const controller = new AbortController(); + controller.abort(); + + await assertThrowsAbortError(async () => { + await client.beginRestore(blobStorageUri, sasToken, folderName, { + ...testPollerProperties, + abortSignal: controller.signal + }); + }); + }); + + it("can abort beginSelectiveRestore", async function() { + const blobStorageUri = env.BLOB_STORAGE_URI; + const sasToken = env.BLOB_STORAGE_SAS_TOKEN; + const folderName = getFolderName(blobStorageUri); + + const controller = new AbortController(); + controller.abort(); + + await assertThrowsAbortError(async () => { + await client.beginSelectiveRestore("Key Name", blobStorageUri, sasToken, folderName, { + ...testPollerProperties, + abortSignal: controller.signal + }); + }); + }); +}); diff --git a/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts new file mode 100644 index 000000000000..a671e2696a35 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { assert } from "chai"; +import { env, Recorder } from "@azure/test-utils-recorder"; +import { KeyClient } from "@azure/keyvault-keys"; + +import { KeyVaultBackupClient } from "../../src"; +import { authenticate } from "../utils/authentication"; +import { testPollerProperties } from "../utils/recorder"; +import { formatName, getFolderName } from "../utils/common"; + +describe("KeyVaultBackupClient", () => { + let client: KeyVaultBackupClient; + let keyClient: KeyClient; + let recorder: Recorder; + + beforeEach(async function() { + const authentication = await authenticate(this); + client = authentication.backupClient; + keyClient = authentication.keyClient; + recorder = authentication.recorder; + }); + + afterEach(async function() { + await recorder.stop(); + }); + + // The tests follow + + it("beginBackup", async function() { + const blobStorageUri = env.BLOB_STORAGE_URI; + const sasToken = env.BLOB_STORAGE_SAS_TOKEN; + const backupPoller = await client.beginBackup(blobStorageUri, sasToken, testPollerProperties); + const backupURI = await backupPoller.pollUntilDone(); + assert.ok(!!backupURI.match(blobStorageUri)); + }); + + it("beginBackup, then beginRestore", async function() { + const blobStorageUri = env.BLOB_STORAGE_URI; + const sasToken = env.BLOB_STORAGE_SAS_TOKEN; + const backupPoller = await client.beginBackup(blobStorageUri, sasToken, testPollerProperties); + const backupURI = await backupPoller.pollUntilDone(); + assert.ok(!!backupURI.match(blobStorageUri)); + + const folderName = getFolderName(blobStorageUri); + const restorePoller = await client.beginRestore( + blobStorageUri, + sasToken, + folderName, + testPollerProperties + ); + await restorePoller.pollUntilDone(); + }); + + it("beginBackup, then beginSelectiveRestore", async function() { + const keyName = formatName(this!.test!.title); + const key = await keyClient.createRsaKey(keyName); + assert.equal(key.name, keyName, "Unexpected key name in result from createRsaKey()."); + + const blobStorageUri = env.BLOB_STORAGE_URI; + const sasToken = env.BLOB_STORAGE_SAS_TOKEN; + const backupPoller = await client.beginBackup(blobStorageUri, sasToken, testPollerProperties); + const backupURI = await backupPoller.pollUntilDone(); + assert.ok(!!backupURI.match(blobStorageUri)); + + const folderName = getFolderName(blobStorageUri); + const selectiveRestorePoller = await client.beginSelectiveRestore( + key.name, + blobStorageUri, + sasToken, + folderName, + testPollerProperties + ); + await selectiveRestorePoller.pollUntilDone(); + + const deleteKeyPoller = await keyClient.beginDeleteKey(keyName); + await deleteKeyPoller.pollUntilDone(); + await keyClient.purgeDeletedKey(keyName); + }); +}); diff --git a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts new file mode 100644 index 000000000000..4c42517f80fe --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AzureCliCredential } from "@azure/identity"; +import { KeyClient } from "@azure/keyvault-keys"; +import { isPlaybackMode, record, RecorderEnvironmentSetup } from "@azure/test-utils-recorder"; +import { v4 as uuidv4 } from "uuid"; + +import { KeyVaultAccessControlClient, KeyVaultBackupClient } from "../../src"; +import { getKeyvaultName, getKeyVaultUrl } from "./common"; +import { uniqueString } from "./recorder"; + +export async function authenticate(that: any): Promise { + function generateFakeUUID(): string { + return isPlaybackMode() ? "b36b00af-89c6-435f-a43d-9a3087015c27" : uuidv4(); + } + + const secretSuffix = uniqueString(); + const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "01ea9a65-813e-4238-8204-bf7328d63fc6", + KEYVAULT_NAME: "keyvault_name" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`), + (recording: any): any => + secretSuffix === "" ? recording : recording.replace(new RegExp(secretSuffix, "g"), ""), + (recording: any): any => + recording.replace( + /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/gi, + "b36b00af-89c6-435f-a43d-9a3087015c27" + ) // Fake UUID + ], + queryParametersToSkip: [] + }; + const recorder = record(that, recorderEnvSetup); + const credential = await new AzureCliCredential(); + + const keyVaultName = getKeyvaultName(); + const keyVaultUrl = getKeyVaultUrl() || `https://${keyVaultName}.vault.azure.net`; + const accessControlClient = new KeyVaultAccessControlClient(keyVaultUrl, credential); + const backupClient = new KeyVaultBackupClient(keyVaultUrl, credential); + const keyClient = new KeyClient(keyVaultUrl, credential); + + return { recorder, accessControlClient, backupClient, keyClient, secretSuffix, generateFakeUUID }; +} diff --git a/sdk/keyvault/keyvault-admin/test/utils/common.ts b/sdk/keyvault/keyvault-admin/test/utils/common.ts new file mode 100644 index 000000000000..9fadb1690c9a --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/utils/common.ts @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { env } from "@azure/test-utils-recorder"; +import * as assert from "assert"; + +// Async iterator's polyfill for Node 8 +if (!Symbol || !(Symbol as any).asyncIterator) { + (Symbol as any).asyncIterator = Symbol.for("Symbol.asyncIterator"); +} + +export function getKeyvaultName(): string { + const keyVaultEnvVarName = "KEYVAULT_NAME"; + const keyVaultName: string | undefined = env[keyVaultEnvVarName]; + + if (!keyVaultName) { + throw new Error(`${keyVaultEnvVarName} environment variable not specified.`); + } + + return keyVaultName; +} + +export function getKeyVaultUrl(): string { + const keyVaultEnvVarName = "KEYVAULT_URL"; + const result: string | undefined = env[keyVaultEnvVarName]; + + return result!; +} + +export async function assertThrowsAbortError(cb: () => Promise): Promise { + let passed = false; + try { + await cb(); + passed = true; + } catch (e) { + console.log(`name: ${e.name}, message: ${e.message}`); + assert.equal(e.name, "AbortError"); + assert.equal(e.message, "The operation was aborted."); + } + + if (passed) { + throw new Error("Expected cb to throw an AbortError"); + } +} + +export function formatName(name: string): string { + return name.replace(/[^0-9a-zA-Z-]/g, ""); +} + +export function getFolderName(storageURI: string): string { + return storageURI; // TODO +} diff --git a/sdk/keyvault/keyvault-admin/test/utils/recorder.ts b/sdk/keyvault/keyvault-admin/test/utils/recorder.ts new file mode 100644 index 000000000000..dce9de46df48 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/utils/recorder.ts @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { isPlaybackMode } from "@azure/test-utils-recorder"; +import { isNode } from "@azure/core-http"; +import * as dotenv from "dotenv"; + +if (isNode) { + dotenv.config(); +} + +export function uniqueString(): string { + return isPlaybackMode() + ? "" + : Math.random() + .toString() + .slice(2); +} + +export const testPollerProperties = { + intervalInMs: isPlaybackMode() ? 0 : undefined +}; diff --git a/sdk/keyvault/keyvault-admin/tests.yml b/sdk/keyvault/keyvault-admin/tests.yml index 6fd4c6143258..911d546c983f 100644 --- a/sdk/keyvault/keyvault-admin/tests.yml +++ b/sdk/keyvault/keyvault-admin/tests.yml @@ -10,3 +10,5 @@ extends: AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) + BLOB_STORAGE_URI: $(blob-storage-uri) + BLOB_STORAGE_SAS_TOKEN: $(blob-storage-sas-token) From 1e47c1e927ea4257ec70823940e4b019ff7d0114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Fri, 4 Sep 2020 10:23:20 -0400 Subject: [PATCH 02/15] Addressing https://github.com/Azure/azure-sdk-for-js/pull/11010#discussion_r483005421 --- .../test/public/accessControlClient.spec.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts index 9cf9be0b412b..e77951edf92b 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts @@ -45,15 +45,8 @@ describe("KeyVaultAccessControlClient", () => { receivedRoles.push(roleDefinition.roleName!); } - assert.deepEqual(receivedRoles, [ - "Managed HSM Administrator", - "Managed HSM Crypto Officer", - "Managed HSM Crypto User", - "Managed HSM Policy Administrator", - "Managed HSM Crypto Auditor", - "Managed HSM Crypto Service Encryption", - "Managed HSM Backup" - ]); + // Roles might change + assert.ok(receivedRoles.length); }); it("createRoleAssignment and deleteRoleAssignment", async function() { From 1bae90c45c5b5f763319da29e24ebe4a42e5c2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Fri, 4 Sep 2020 15:00:03 -0400 Subject: [PATCH 03/15] recent feedback and changes after recent API changes --- .../test/public/accessControlClient.spec.ts | 16 ++++++++++++---- .../test/public/backupClient.abort.spec.ts | 2 +- .../test/public/backupClient.spec.ts | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts index e77951edf92b..5c8fc594a500 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts @@ -52,7 +52,7 @@ describe("KeyVaultAccessControlClient", () => { it("createRoleAssignment and deleteRoleAssignment", async function() { const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; const name = generateFakeUUID(); - const assignment = await client.createRoleAssignment( + let assignment = await client.createRoleAssignment( globalScope, name, roleDefinition.id!, @@ -61,17 +61,25 @@ describe("KeyVaultAccessControlClient", () => { assert.equal(assignment.name, name); assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); - await client.deleteRoleAssignment(globalScope, name); + + assignment = await client.deleteRoleAssignment(globalScope, name); + assert.equal(assignment.name, name); + assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); + assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); }); it("createRoleAssignment, getRoleAssignment and deleteRoleAssignment", async function() { const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; const name = generateFakeUUID(); await client.createRoleAssignment(globalScope, name, roleDefinition.id!, env.AZURE_TENANT_ID); - const assignment = await client.getRoleAssignment(globalScope, name); + let assignment = await client.getRoleAssignment(globalScope, name); + assert.equal(assignment.name, name); + assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); + assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); + + assignment = await client.deleteRoleAssignment(globalScope, name); assert.equal(assignment.name, name); assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); - await client.deleteRoleAssignment(globalScope, name); }); }); diff --git a/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts b/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts index 1259f93af8d9..c017b8bd4df4 100644 --- a/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts @@ -65,7 +65,7 @@ describe("Aborting KeyVaultBackupClient's requests", () => { controller.abort(); await assertThrowsAbortError(async () => { - await client.beginSelectiveRestore("Key Name", blobStorageUri, sasToken, folderName, { + await client.beginSelectiveRestore(blobStorageUri, sasToken, folderName, "Key Name", { ...testPollerProperties, abortSignal: controller.signal }); diff --git a/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts index a671e2696a35..9d6a427930e3 100644 --- a/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts @@ -66,10 +66,10 @@ describe("KeyVaultBackupClient", () => { const folderName = getFolderName(blobStorageUri); const selectiveRestorePoller = await client.beginSelectiveRestore( - key.name, blobStorageUri, sasToken, folderName, + key.name, testPollerProperties ); await selectiveRestorePoller.pollUntilDone(); From 8406f27aef19009b1e3dab745ff069b74bb3cf00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Fri, 4 Sep 2020 17:07:21 -0400 Subject: [PATCH 04/15] environment variable changes and SAS token recorder cleanup SAS tokens for the test account were leaked in the last PR with the recordings. These keys have been revoked by this point. I added the code to ensure a leak like this won't happen again. --- .../keyvaultbackupclient/recording_beginbackup.js | 2 +- .../recording_beginbackup_then_beginrestore.js | 4 ++-- ...cording_beginbackup_then_beginselectiverestore.js | 4 ++-- .../test/public/accessControlClient.aborts.spec.ts | 2 +- .../test/public/accessControlClient.spec.ts | 12 ++++++------ .../keyvault-admin/test/utils/authentication.ts | 4 +++- sdk/keyvault/keyvault-admin/tests.yml | 2 -- sdk/keyvault/test-resources.json | 12 ++++++++++++ 8 files changed, 27 insertions(+), 15 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js index 3e3c9adb258b..70f9ce320f74 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js @@ -29,7 +29,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'no-cache' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"?sv=2019-12-12&ss=bfqt&srt=sco&sp=rwdlacupx&se=2022-07-14T05:56:52Z&st=2020-09-03T21:56:52Z&spr=https,http&sig=Rzts1hBG%2BgqTCTZo%2BX%2FZgJWJ5Ao16ueN%2F1BB4Dg8%2FLo%3D"}) + .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599226645,"endTime":null,"jobId":"bf6dcbae3b3b407b98a2998b8d434351","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js index 70cf3f8aad7b..19b7d329917a 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js @@ -29,7 +29,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'no-cache' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"?sv=2019-12-12&ss=bfqt&srt=sco&sp=rwdlacupx&se=2022-07-14T05:56:52Z&st=2020-09-03T21:56:52Z&spr=https,http&sig=Rzts1hBG%2BgqTCTZo%2BX%2FZgJWJ5Ao16ueN%2F1BB4Dg8%2FLo%3D"}) + .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599226672,"endTime":null,"jobId":"3b6fd673a64144b1bc6c8c9979cf2d2f","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', @@ -255,7 +255,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"?sv=2019-12-12&ss=bfqt&srt=sco&sp=rwdlacupx&se=2022-07-14T05:56:52Z&st=2020-09-03T21:56:52Z&spr=https,http&sig=Rzts1hBG%2BgqTCTZo%2BX%2FZgJWJ5Ao16ueN%2F1BB4Dg8%2FLo%3D"},"folderToRestore":"https://chrissprim.blob.core.windows.net/backup"}) + .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folderToRestore":"https://chrissprim.blob.core.windows.net/backup"}) .query(true) .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"928034973f004fe8b203438bda65e9db","startTime":1599226685,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js index 7a95d69d6b0b..8334168ed0b9 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js @@ -79,7 +79,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'no-cache' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"?sv=2019-12-12&ss=bfqt&srt=sco&sp=rwdlacupx&se=2022-07-14T05:56:52Z&st=2020-09-03T21:56:52Z&spr=https,http&sig=Rzts1hBG%2BgqTCTZo%2BX%2FZgJWJ5Ao16ueN%2F1BB4Dg8%2FLo%3D"}) + .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599226710,"endTime":null,"jobId":"9c1ab31ae44c4cf09ac1b5bfe88b5e4f","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', @@ -305,7 +305,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .put('/keys/beginBackupthenbeginSelectiveRestore/restore', {"sasTokenParameters":{"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"?sv=2019-12-12&ss=bfqt&srt=sco&sp=rwdlacupx&se=2022-07-14T05:56:52Z&st=2020-09-03T21:56:52Z&spr=https,http&sig=Rzts1hBG%2BgqTCTZo%2BX%2FZgJWJ5Ao16ueN%2F1BB4Dg8%2FLo%3D"},"folder":"https://chrissprim.blob.core.windows.net/backup"}) + .put('/keys/beginBackupthenbeginSelectiveRestore/restore', {"sasTokenParameters":{"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folder":"https://chrissprim.blob.core.windows.net/backup"}) .query(true) .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"ae2bf388a4dd471885cd2b247ed5e0f9","startTime":1599226723,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts index c9cc9d3f9fc1..ad24207f4f07 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts @@ -48,7 +48,7 @@ describe("Aborting KeyVaultAccessControlClient's requests", () => { controller.abort(); await assertThrowsAbortError(async () => { - await client.createRoleAssignment(globalScope, name, roleDefinitionId, env.AZURE_TENANT_ID, { + await client.createRoleAssignment(globalScope, name, roleDefinitionId, env.CLIENT_OBJECT_ID, { abortSignal: controller.signal }); }); diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts index 5c8fc594a500..6d6fba845a9b 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts @@ -56,30 +56,30 @@ describe("KeyVaultAccessControlClient", () => { globalScope, name, roleDefinition.id!, - env.AZURE_TENANT_ID + env.CLIENT_OBJECT_ID ); assert.equal(assignment.name, name); assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); - assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); + assert.equal(assignment.properties?.principalId, env.CLIENT_OBJECT_ID); assignment = await client.deleteRoleAssignment(globalScope, name); assert.equal(assignment.name, name); assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); - assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); + assert.equal(assignment.properties?.principalId, env.CLIENT_OBJECT_ID); }); it("createRoleAssignment, getRoleAssignment and deleteRoleAssignment", async function() { const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; const name = generateFakeUUID(); - await client.createRoleAssignment(globalScope, name, roleDefinition.id!, env.AZURE_TENANT_ID); + await client.createRoleAssignment(globalScope, name, roleDefinition.id!, env.CLIENT_OBJECT_ID); let assignment = await client.getRoleAssignment(globalScope, name); assert.equal(assignment.name, name); assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); - assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); + assert.equal(assignment.properties?.principalId, env.CLIENT_OBJECT_ID); assignment = await client.deleteRoleAssignment(globalScope, name); assert.equal(assignment.name, name); assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); - assert.equal(assignment.properties?.principalId, env.AZURE_TENANT_ID); + assert.equal(assignment.properties?.principalId, env.CLIENT_OBJECT_ID); }); }); diff --git a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts index 4c42517f80fe..ab566ac36f09 100644 --- a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts +++ b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts @@ -19,8 +19,10 @@ export async function authenticate(that: any): Promise { const recorderEnvSetup: RecorderEnvironmentSetup = { replaceableVariables: { AZURE_CLIENT_ID: "azure_client_id", + AZURE_TENANT_ID: "azure_tenant_id", AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "01ea9a65-813e-4238-8204-bf7328d63fc6", + CLIENT_OBJECT_ID: "01ea9a65-813e-4238-8204-bf7328d63fc6", + BLOB_STORAGE_SAS_TOKEN: "blob_storage_sas_token", KEYVAULT_NAME: "keyvault_name" }, customizationsOnRecordings: [ diff --git a/sdk/keyvault/keyvault-admin/tests.yml b/sdk/keyvault/keyvault-admin/tests.yml index 911d546c983f..6fd4c6143258 100644 --- a/sdk/keyvault/keyvault-admin/tests.yml +++ b/sdk/keyvault/keyvault-admin/tests.yml @@ -10,5 +10,3 @@ extends: AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) - BLOB_STORAGE_URI: $(blob-storage-uri) - BLOB_STORAGE_SAS_TOKEN: $(blob-storage-sas-token) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index ba3247a817fb..2d646f901c21 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -98,6 +98,18 @@ "KEYVAULT_URI": { "type": "string", "value": "[reference(variables('keyVaultName')).vaultUri]" + }, + "CLIENT_OBJECT_ID": { + "type": "string", + "value": "[parameters('testApplicationOid')]" + }, + "BLOB_STORAGE_URI": { + "type": "string", + "value": "7.2-preview-blob-storage-uri" + }, + "BLOB_STORAGE_SAS_TOKEN": { + "type": "string", + "value": "7.2-preview-blob-storage-sas-uri" } } } From 6f849c151b50888457e2326b8d5da3c98b82416a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Fri, 4 Sep 2020 18:24:37 -0400 Subject: [PATCH 05/15] test-resources has KEYVAULT_URI --- sdk/keyvault/keyvault-admin/test/utils/common.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/keyvault/keyvault-admin/test/utils/common.ts b/sdk/keyvault/keyvault-admin/test/utils/common.ts index 9fadb1690c9a..e63792df5573 100644 --- a/sdk/keyvault/keyvault-admin/test/utils/common.ts +++ b/sdk/keyvault/keyvault-admin/test/utils/common.ts @@ -20,8 +20,9 @@ export function getKeyvaultName(): string { return keyVaultName; } +// The property in the clients is called vaultUrl, but the environment variable is KEYVAULT_URI. export function getKeyVaultUrl(): string { - const keyVaultEnvVarName = "KEYVAULT_URL"; + const keyVaultEnvVarName = "KEYVAULT_URI"; const result: string | undefined = env[keyVaultEnvVarName]; return result!; From f3b9e8aa9b6fe4d4fef597900d1ed4488949e8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Tue, 8 Sep 2020 12:50:51 -0400 Subject: [PATCH 06/15] new tests that wont pass, but that I want to have --- .../src/generated/keyVaultClientContext.ts | 2 +- .../internal/serviceVersionParameter.spec.ts | 131 ++++++++++++++++++ .../test/internal/userAgent.spec.ts | 35 +++++ .../test/public/accessControlClient.spec.ts | 23 +++ 4 files changed, 190 insertions(+), 1 deletion(-) create mode 100644 sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts create mode 100644 sdk/keyvault/keyvault-admin/test/internal/userAgent.spec.ts diff --git a/sdk/keyvault/keyvault-admin/src/generated/keyVaultClientContext.ts b/sdk/keyvault/keyvault-admin/src/generated/keyVaultClientContext.ts index caa6633be660..b50514c4eef3 100644 --- a/sdk/keyvault/keyvault-admin/src/generated/keyVaultClientContext.ts +++ b/sdk/keyvault/keyvault-admin/src/generated/keyVaultClientContext.ts @@ -10,7 +10,7 @@ import * as coreHttp from "@azure/core-http"; import { KeyVaultClientOptionalParams } from "./models"; const packageName = "@azure/keyvault-admin"; -const packageVersion = "1.0.0"; +export const packageVersion = "4.0.0-beta.1"; export class KeyVaultClientContext extends coreHttp.ServiceClient { apiVersion: string; diff --git a/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts new file mode 100644 index 000000000000..58894e89c902 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as assert from "assert"; +import { createSandbox, SinonSandbox, SinonSpy } from "sinon"; +import { KeyVaultAccessControlClient, KeyVaultBackupClient } from "../../src"; +import { LATEST_API_VERSION } from "../../src/constants"; +import { HttpClient, WebResourceLike, HttpOperationResponse, HttpHeaders } from "@azure/core-http"; +import { ClientSecretCredential } from "@azure/identity"; +import { env } from "@azure/test-utils-recorder"; + +// TODO: Don't review this file yet, I can't test this. + +describe("The keyvault-admin clients should set the serviceVersion", () => { + const keyVaultUrl = `https://keyVaultName.vault.azure.net`; + + const mockHttpClient: HttpClient = { + async sendRequest(httpRequest: WebResourceLike): Promise { + return { + status: 200, + headers: new HttpHeaders(), + request: httpRequest, + parsedBody: { + id: `${keyVaultUrl}/secrets/secretName/id`, + attributes: {} + } + }; + } + }; + + let sandbox: SinonSandbox; + let spy: SinonSpy<[WebResourceLike], Promise>; + let credential: ClientSecretCredential; + + beforeEach(async () => { + sandbox = createSandbox(); + spy = sandbox.spy(mockHttpClient, "sendRequest"); + + credential = await new ClientSecretCredential( + env.AZURE_TENANT_ID!, + env.AZURE_CLIENT_ID!, + env.AZURE_CLIENT_SECRET! + ); + }); + + afterEach(() => { + sandbox.restore(); + }); + + describe("KeyVaultAccessControlClient", () => { + it("it should default to the latest API version", async function() { + const client = new SecretClient(keyVaultUrl, credential, { + httpClient: mockHttpClient + }); + await client.setSecret("secretName", "value"); + + const calls = spy.getCalls(); + assert.equal( + calls[0].args[0].url, + `https://keyVaultName.vault.azure.net/secrets/secretName?api-version=${LATEST_API_VERSION}` + ); + }); + + // Adding this to the source would change the public API. + type ApIVersions = "7.0" | "7.1"; + + it("it should allow us to specify an API version from a specific set of versions", async function() { + const versions: ApIVersions[] = ["7.0", "7.1"]; + for (const serviceVersion in versions) { + const credential = await new ClientSecretCredential( + env.AZURE_TENANT_ID!, + env.AZURE_CLIENT_ID!, + env.AZURE_CLIENT_SECRET! + ); + const client = new SecretClient(keyVaultUrl, credential, { + serviceVersion: serviceVersion as ApIVersions, + httpClient: mockHttpClient + }); + await client.setSecret("secretName", "value"); + + const calls = spy.getCalls(); + const lastCall = calls[calls.length - 1]; + assert.equal( + lastCall.args[0].url, + `https://keyVaultName.vault.azure.net/secrets/secretName?api-version=${serviceVersion}` + ); + } + }); + }); + + describe("KeyVaultBackupClient", () => { + it("it should default to the latest API version", async function() { + const client = new KeyVaultBackupClient(keyVaultUrl, credential, { + httpClient: mockHttpClient + }); + await client.setSecret("secretName", "value"); + + const calls = spy.getCalls(); + assert.equal( + calls[0].args[0].url, + `https://keyVaultName.vault.azure.net/secrets/secretName?api-version=${LATEST_API_VERSION}` + ); + }); + + // Adding this to the source would change the public API. + type ApIVersions = "7.0" | "7.1"; + + it("it should allow us to specify an API version from a specific set of versions", async function() { + const versions: ApIVersions[] = ["7.0", "7.1"]; + for (const serviceVersion in versions) { + const credential = await new ClientSecretCredential( + env.AZURE_TENANT_ID!, + env.AZURE_CLIENT_ID!, + env.AZURE_CLIENT_SECRET! + ); + const client = new KeyVaultBackupClient(keyVaultUrl, credential, { + serviceVersion: serviceVersion as ApIVersions, + httpClient: mockHttpClient + }); + await client.setSecret("secretName", "value"); + + const calls = spy.getCalls(); + const lastCall = calls[calls.length - 1]; + assert.equal( + lastCall.args[0].url, + `https://keyVaultName.vault.azure.net/secrets/secretName?api-version=${serviceVersion}` + ); + } + }); + }); +}); diff --git a/sdk/keyvault/keyvault-admin/test/internal/userAgent.spec.ts b/sdk/keyvault/keyvault-admin/test/internal/userAgent.spec.ts new file mode 100644 index 000000000000..548e5ddddde1 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/internal/userAgent.spec.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import * as assert from "assert"; +import { SDK_VERSION } from "../../src/constants"; +import { packageVersion } from "../../src/generated/keyVaultClientContext"; +import { isNode } from "@azure/core-http"; +import path from "path"; +import fs from "fs"; + +describe("Secrets Admin's user agent (only in Node, because of fs)", () => { + it("SDK_VERSION and packageVersion should match", async function() { + assert.equal(SDK_VERSION, packageVersion); + }); + + it("the version should also match with the one available in the package.json (only in Node, because of fs)", async function() { + if (!isNode) { + this.skip(); + return; + } + let version: string; + try { + const fileContents = JSON.parse( + fs.readFileSync(path.join(__dirname, "../package.json"), { encoding: "utf-8" }) + ); + version = fileContents.version; + } catch { + const fileContents = JSON.parse( + fs.readFileSync(path.join(__dirname, "../../../../package.json"), { encoding: "utf-8" }) + ); + version = fileContents.version; + } + assert.equal(version, packageVersion); + }); +}); diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts index 6d6fba845a9b..661668ee54be 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts @@ -49,6 +49,29 @@ describe("KeyVaultAccessControlClient", () => { assert.ok(receivedRoles.length); }); + it("listRoleAssignments", async function() { + const expectedType = "Microsoft.Authorization/roleAssignments"; + let receivedRoles: string[] = []; + + for await (const roleAssignment of client.listRoleAssignments("/")) { + // Each role assignment will have the shape of: + // + // { + // id: 'Microsoft.KeyVault/providers/Microsoft.Authorization/roleAssignment/', + // name: '', + // type: '', + // // ... + // } + // + console.log({ roleAssignment }); + assert.equal(roleAssignment.type, expectedType); + receivedRoles.push(roleAssignment.roleName!); + } + + // Roles might change + assert.ok(receivedRoles.length); + }); + it("createRoleAssignment and deleteRoleAssignment", async function() { const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; const name = generateFakeUUID(); From 944615e1c8120d06dc6e657748531bf8bdafb09b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Wed, 9 Sep 2020 21:19:43 -0400 Subject: [PATCH 07/15] wip --- sdk/keyvault/keyvault-admin/package.json | 4 +- sdk/keyvault/keyvault-admin/src/constants.ts | 2 +- .../internal/serviceVersionParameter.spec.ts | 195 ++++++++++-------- .../test/public/accessControlClient.spec.ts | 2 +- 4 files changed, 112 insertions(+), 91 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/package.json b/sdk/keyvault/keyvault-admin/package.json index 6fad55e16cf7..4787e2d3111d 100644 --- a/sdk/keyvault/keyvault-admin/package.json +++ b/sdk/keyvault/keyvault-admin/package.json @@ -2,7 +2,7 @@ "name": "@azure/keyvault-admin", "sdk-type": "client", "author": "Microsoft Corporation", - "version": "1.0.0-preview.1", + "version": "4.0.0-beta.1", "license": "MIT", "description": "Isomorphic client library for Azure KeyVault's administrative functions.", "homepage": "https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/README.md", @@ -97,6 +97,7 @@ "@rollup/plugin-node-resolve": "^8.0.0", "@rollup/plugin-replace": "^2.2.0", "@types/chai": "^4.1.6", + "@types/sinon": "^9.0.4", "@types/fs-extra": "^8.0.0", "@types/mocha": "^7.0.2", "@types/node": "^8.0.0", @@ -136,6 +137,7 @@ "rollup-plugin-sourcemaps": "^0.4.2", "rollup-plugin-terser": "^5.1.1", "rollup-plugin-visualizer": "^4.0.4", + "sinon": "^9.0.2", "source-map-support": "^0.5.9", "typescript": "~3.9.3", "uuid": "^8.1.0" diff --git a/sdk/keyvault/keyvault-admin/src/constants.ts b/sdk/keyvault/keyvault-admin/src/constants.ts index 338927424b4e..bf8c98afb7df 100644 --- a/sdk/keyvault/keyvault-admin/src/constants.ts +++ b/sdk/keyvault/keyvault-admin/src/constants.ts @@ -4,7 +4,7 @@ /** * Current version of the Key Vault Admin SDK. */ -export const SDK_VERSION: string = "4.1.0"; +export const SDK_VERSION: string = "4.0.0-beta.1"; /** * The latest supported Key Vault service API version. diff --git a/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts index 58894e89c902..2938caab5123 100644 --- a/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts @@ -9,123 +9,142 @@ import { HttpClient, WebResourceLike, HttpOperationResponse, HttpHeaders } from import { ClientSecretCredential } from "@azure/identity"; import { env } from "@azure/test-utils-recorder"; -// TODO: Don't review this file yet, I can't test this. +// Adding this to the source would change the public API. +type ApIVersions = "7.2-preview"; describe("The keyvault-admin clients should set the serviceVersion", () => { - const keyVaultUrl = `https://keyVaultName.vault.azure.net`; - - const mockHttpClient: HttpClient = { - async sendRequest(httpRequest: WebResourceLike): Promise { - return { - status: 200, - headers: new HttpHeaders(), - request: httpRequest, - parsedBody: { - id: `${keyVaultUrl}/secrets/secretName/id`, - attributes: {} - } - }; - } - }; - - let sandbox: SinonSandbox; - let spy: SinonSpy<[WebResourceLike], Promise>; - let credential: ClientSecretCredential; - - beforeEach(async () => { - sandbox = createSandbox(); - spy = sandbox.spy(mockHttpClient, "sendRequest"); - - credential = await new ClientSecretCredential( - env.AZURE_TENANT_ID!, - env.AZURE_CLIENT_ID!, - env.AZURE_CLIENT_SECRET! - ); - }); - - afterEach(() => { - sandbox.restore(); - }); + const keyVaultUrl = `https://eastus2.keyvault_name.managedhsm-int.azure-int.net`; describe("KeyVaultAccessControlClient", () => { + const mockHttpClient: HttpClient = { + async sendRequest(httpRequest: WebResourceLike): Promise { + return { + status: 200, + headers: new HttpHeaders(), + request: httpRequest, + parsedBody: { + id: `${keyVaultUrl}/providers/Microsoft.Authorization/roleDefinitions`, + attributes: {} + } + }; + } + }; + + let sandbox: SinonSandbox; + let spy: SinonSpy<[WebResourceLike], Promise>; + let credential: ClientSecretCredential; + + beforeEach(async () => { + sandbox = createSandbox(); + spy = sandbox.spy(mockHttpClient, "sendRequest"); + + credential = await new ClientSecretCredential( + env.AZURE_TENANT_ID!, + env.AZURE_CLIENT_ID!, + env.AZURE_CLIENT_SECRET! + ); + }); + + afterEach(() => { + sandbox.restore(); + }); + it("it should default to the latest API version", async function() { - const client = new SecretClient(keyVaultUrl, credential, { + const client = new KeyVaultAccessControlClient(keyVaultUrl, credential, { httpClient: mockHttpClient }); - await client.setSecret("secretName", "value"); - + await client.listRoleDefinitions("/").next(); const calls = spy.getCalls(); assert.equal( calls[0].args[0].url, - `https://keyVaultName.vault.azure.net/secrets/secretName?api-version=${LATEST_API_VERSION}` + `${keyVaultUrl}///providers/Microsoft.Authorization/roleDefinitions?api-version=${LATEST_API_VERSION}` ); }); - // Adding this to the source would change the public API. - type ApIVersions = "7.0" | "7.1"; - it("it should allow us to specify an API version from a specific set of versions", async function() { - const versions: ApIVersions[] = ["7.0", "7.1"]; - for (const serviceVersion in versions) { - const credential = await new ClientSecretCredential( - env.AZURE_TENANT_ID!, - env.AZURE_CLIENT_ID!, - env.AZURE_CLIENT_SECRET! - ); - const client = new SecretClient(keyVaultUrl, credential, { - serviceVersion: serviceVersion as ApIVersions, - httpClient: mockHttpClient - }); - await client.setSecret("secretName", "value"); + const serviceVersion = "7.2-preview"; + const credential = await new ClientSecretCredential( + env.AZURE_TENANT_ID!, + env.AZURE_CLIENT_ID!, + env.AZURE_CLIENT_SECRET! + ); + const client = new KeyVaultAccessControlClient(keyVaultUrl, credential, { + serviceVersion: serviceVersion as ApIVersions, + httpClient: mockHttpClient + }); + await client.listRoleDefinitions("/").next(); - const calls = spy.getCalls(); - const lastCall = calls[calls.length - 1]; - assert.equal( - lastCall.args[0].url, - `https://keyVaultName.vault.azure.net/secrets/secretName?api-version=${serviceVersion}` - ); - } + const calls = spy.getCalls(); + const lastCall = calls[calls.length - 1]; + assert.equal( + lastCall.args[0].url, + `${keyVaultUrl}///providers/Microsoft.Authorization/roleDefinitions?api-version=${serviceVersion}` + ); }); }); describe("KeyVaultBackupClient", () => { + const mockHttpClient: HttpClient = { + async sendRequest(httpRequest: WebResourceLike): Promise { + return { + status: 200, + headers: new HttpHeaders(), + request: httpRequest, + parsedBody: { + id: `${keyVaultUrl}/backup`, + attributes: {} + } + }; + } + }; + + let sandbox: SinonSandbox; + let spy: SinonSpy<[WebResourceLike], Promise>; + let credential: ClientSecretCredential; + + beforeEach(async () => { + sandbox = createSandbox(); + spy = sandbox.spy(mockHttpClient, "sendRequest"); + + credential = await new ClientSecretCredential( + env.AZURE_TENANT_ID!, + env.AZURE_CLIENT_ID!, + env.AZURE_CLIENT_SECRET! + ); + }); + + afterEach(() => { + sandbox.restore(); + }); + it("it should default to the latest API version", async function() { const client = new KeyVaultBackupClient(keyVaultUrl, credential, { httpClient: mockHttpClient }); - await client.setSecret("secretName", "value"); + const backupPoller = await client.beginBackup("secretName", "value"); + await backupPoller.pollUntilDone(); const calls = spy.getCalls(); - assert.equal( - calls[0].args[0].url, - `https://keyVaultName.vault.azure.net/secrets/secretName?api-version=${LATEST_API_VERSION}` - ); + assert.equal(calls[0].args[0].url, `${keyVaultUrl}/backup?api-version=${LATEST_API_VERSION}`); }); - // Adding this to the source would change the public API. - type ApIVersions = "7.0" | "7.1"; - it("it should allow us to specify an API version from a specific set of versions", async function() { - const versions: ApIVersions[] = ["7.0", "7.1"]; - for (const serviceVersion in versions) { - const credential = await new ClientSecretCredential( - env.AZURE_TENANT_ID!, - env.AZURE_CLIENT_ID!, - env.AZURE_CLIENT_SECRET! - ); - const client = new KeyVaultBackupClient(keyVaultUrl, credential, { - serviceVersion: serviceVersion as ApIVersions, - httpClient: mockHttpClient - }); - await client.setSecret("secretName", "value"); + const serviceVersion = "7.2-preview"; + const credential = await new ClientSecretCredential( + env.AZURE_TENANT_ID!, + env.AZURE_CLIENT_ID!, + env.AZURE_CLIENT_SECRET! + ); + const client = new KeyVaultBackupClient(keyVaultUrl, credential, { + serviceVersion: serviceVersion as ApIVersions, + httpClient: mockHttpClient + }); + const backupPoller = await client.beginBackup("secretName", "value"); + await backupPoller.pollUntilDone(); - const calls = spy.getCalls(); - const lastCall = calls[calls.length - 1]; - assert.equal( - lastCall.args[0].url, - `https://keyVaultName.vault.azure.net/secrets/secretName?api-version=${serviceVersion}` - ); - } + const calls = spy.getCalls(); + const lastCall = calls[calls.length - 1]; + assert.equal(lastCall.args[0].url, `${keyVaultUrl}/backup?api-version=${serviceVersion}`); }); }); }); diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts index 661668ee54be..68c73a3d416f 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts @@ -65,7 +65,7 @@ describe("KeyVaultAccessControlClient", () => { // console.log({ roleAssignment }); assert.equal(roleAssignment.type, expectedType); - receivedRoles.push(roleAssignment.roleName!); + receivedRoles.push(roleAssignment.name); } // Roles might change From eb246d26f3139935194cf58a53887adc34732499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Thu, 10 Sep 2020 11:24:30 -0400 Subject: [PATCH 08/15] updates after the full source was merged --- ...ecording_can_abort_createroleassignment.js | 2 +- ...ecording_can_abort_deleteroleassignment.js | 2 +- .../recording_can_abort_getroleassignment.js | 2 +- ...ecording_can_abort_listroleassignments.js} | 2 +- ...cording_can_abort_beginselectiverestore.js | 2 +- ...roleassignment_and_deleteroleassignment.js | 111 --------------- ...roleassignment_and_deleteroleassignment.js | 70 +++++++--- .../recording_deleteroleassignment.js | 5 - .../recording_getroleassignment.js | 5 - .../recording_listroleassignments.js | 59 ++++++++ .../recording_listroledefinitions.js | 10 +- .../recording_beginbackup.js | 108 ++++++--------- ...recording_beginbackup_then_beginrestore.js | 124 ++++++++--------- ..._beginbackup_then_beginselectiverestore.js | 126 +++++++++--------- .../src/lro/backup/operation.ts | 14 +- .../src/lro/restore/operation.ts | 6 +- .../internal/serviceVersionParameter.spec.ts | 67 ++++------ .../public/accessControlClient.aborts.spec.ts | 13 ++ .../test/public/accessControlClient.spec.ts | 31 +++-- .../test/utils/authentication.ts | 25 +++- 20 files changed, 365 insertions(+), 419 deletions(-) rename sdk/keyvault/keyvault-admin/recordings/node/{keyvaultaccesscontrolclient/recording_createroleassignment.js => aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_listroleassignments.js} (60%) delete mode 100644 sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_and_deleteroleassignment.js delete mode 100644 sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_deleteroleassignment.js delete mode 100644 sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_getroleassignment.js create mode 100644 sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroleassignments.js diff --git a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_createroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_createroleassignment.js index bc33caa4f078..f40e503c6020 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_createroleassignment.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_createroleassignment.js @@ -1,5 +1,5 @@ let nock = require('nock'); -module.exports.hash = "61a24d5c1194fb74a2cf7d76d418c781"; +module.exports.hash = "9c172c4656e4629ca849292a53f63e69"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_deleteroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_deleteroleassignment.js index fa9a214a343b..daf26d287209 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_deleteroleassignment.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_deleteroleassignment.js @@ -1,5 +1,5 @@ let nock = require('nock'); -module.exports.hash = "73948c7b1e3d66995a9b4147f2dfd4f4"; +module.exports.hash = "ec4c6c9f6fc235fd128add02b39994d7"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_getroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_getroleassignment.js index 1c2fccf01398..c3bfc5862974 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_getroleassignment.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_getroleassignment.js @@ -1,5 +1,5 @@ let nock = require('nock'); -module.exports.hash = "dba9a670e39675d10052ef8a35131cdb"; +module.exports.hash = "13040817b44ca1bf01b149d9ca4f1820"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_listroleassignments.js similarity index 60% rename from sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment.js rename to sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_listroleassignments.js index e7f9fb2845f1..471877cf9def 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultaccesscontrolclients_requests/recording_can_abort_listroleassignments.js @@ -1,5 +1,5 @@ let nock = require('nock'); -module.exports.hash = "d43e150d39ab608a9b267caaf34a5438"; +module.exports.hash = "e99fae533ce806665682342192c1bd3f"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js index 30ea42ece820..9bac56880e18 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js @@ -1,5 +1,5 @@ let nock = require('nock'); -module.exports.hash = "a36bb43f30938e3f817ddbacbb1b33a7"; +module.exports.hash = "da4bd9e6492febca8f9d8a2d0c8d9074"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_and_deleteroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_and_deleteroleassignment.js deleted file mode 100644 index fde88bc6baa2..000000000000 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_and_deleteroleassignment.js +++ /dev/null @@ -1,111 +0,0 @@ -let nock = require('nock'); - -module.exports.hash = "f923e14cbc18072ddfc5051e64241fb2"; - -module.exports.testInfo = {"uniqueName":{},"newDate":{}} - -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('///providers/Microsoft.Authorization/roleDefinitions') - .query(true) - .reply(401, "OK", [ 'content-type', - 'application/json; charset=utf-8', - 'x-content-type-options', - 'nosniff', - 'www-authenticate', - 'Bearer authorization="https://login.windows-ppe.net/01ea9a65-813e-4238-8204-bf7328d63fc6", resource="https://managedhsm-int.azure-int.net"', - 'x-frame-options', - 'SAMEORIGIN', - 'content-length', - '2', - 'x-ms-request-id', - 'c8760180-ec6b-11ea-a7a1-0242ac120008', - 'strict-transport-security', - 'max-age=31536000; includeSubDomains', - 'content-security-policy', - 'default-src \'self\'', - 'x-ms-build-version', - '1.0.20200901-1-40187cd0-develop', - 'cache-control', - 'no-cache', - 'x-ms-server-latency', - '1' ]); - -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('///providers/Microsoft.Authorization/roleDefinitions') - .query(true) - .reply(200, {"value":[{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","name":"a290e904-7015-4bba-90c8-60543313cdb4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete","Microsoft.KeyVault/managedHsm/securitydomain/download/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/read","Microsoft.KeyVault/managedHsm/securitydomain/transferkey/read","Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/restore/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/restore/status/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/515eb02d-2335-4d2d-92f2-b1cbdf9c3778","name":"515eb02d-2335-4d2d-92f2-b1cbdf9c3778","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Officer","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/21dbd100-6940-42c2-9190-5d6cb909625b","name":"21dbd100-6940-42c2-9190-5d6cb909625b","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto User","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/4bd23610-cdcf-4971-bdee-bdc562cc28e4","name":"4bd23610-cdcf-4971-bdee-bdc562cc28e4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Policy Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","name":"2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Auditor","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/33413926-3206-4cdd-b39a-83574fe37a17","name":"33413926-3206-4cdd-b39a-83574fe37a17","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Service Encryption","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","name":"7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/keys/backup/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Backup","type":""},"type":"Microsoft.Authorization/roleDefinitions"}]}, [ 'x-frame-options', - 'SAMEORIGIN', - 'x-ms-request-id', - 'c8760180-ec6b-11ea-a7a1-0242ac120008', - 'content-type', - 'application/json; charset=utf-8', - 'x-ms-keyvault-region', - 'EASTUS', - 'content-length', - '6428', - 'strict-transport-security', - 'max-age=31536000; includeSubDomains', - 'content-security-policy', - 'default-src \'self\'', - 'cache-control', - 'no-cache', - 'x-content-type-options', - 'nosniff', - 'x-ms-build-version', - '1.0.20200901-1-40187cd0-develop', - 'x-ms-keyvault-network-info', - 'addr=108.226.109.105', - 'x-ms-server-latency', - '1' ]); - -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .put('///providers/Microsoft.Authorization/roleAssignments/d759623d-3216-4ca2-8742-7c455b346edd', {"properties":{"roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6"}}) - .query(true) - .reply(201, {"id":"/providers/Microsoft.Authorization/roleAssignments/d759623d-3216-4ca2-8742-7c455b346edd","name":"d759623d-3216-4ca2-8742-7c455b346edd","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'content-type', - 'application/json; charset=utf-8', - 'x-content-type-options', - 'nosniff', - 'content-length', - '398', - 'x-ms-request-id', - 'c8760180-ec6b-11ea-a7a1-0242ac120008', - 'x-ms-keyvault-region', - 'EASTUS', - 'strict-transport-security', - 'max-age=31536000; includeSubDomains', - 'content-security-policy', - 'default-src \'self\'', - 'x-ms-keyvault-network-info', - 'addr=108.226.109.105', - 'x-ms-server-latency', - '264', - 'cache-control', - 'no-cache', - 'x-frame-options', - 'SAMEORIGIN' ]); - -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .delete('///providers/Microsoft.Authorization/roleAssignments/d759623d-3216-4ca2-8742-7c455b346edd') - .query(true) - .reply(200, {"id":"/providers/Microsoft.Authorization/roleAssignments/d759623d-3216-4ca2-8742-7c455b346edd","name":"d759623d-3216-4ca2-8742-7c455b346edd","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'content-type', - 'application/json; charset=utf-8', - 'x-content-type-options', - 'nosniff', - 'content-length', - '398', - 'x-ms-request-id', - 'c8760180-ec6b-11ea-a7a1-0242ac120008', - 'x-ms-keyvault-region', - 'EASTUS', - 'strict-transport-security', - 'max-age=31536000; includeSubDomains', - 'content-security-policy', - 'default-src \'self\'', - 'x-ms-keyvault-network-info', - 'addr=108.226.109.105', - 'x-ms-server-latency', - '277', - 'cache-control', - 'no-cache', - 'x-frame-options', - 'SAMEORIGIN' ]); diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js index 7a3fa3c8a4f3..760124fc1f2c 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js @@ -1,42 +1,70 @@ let nock = require('nock'); -module.exports.hash = "a53145d563369b7a1285efc043840c75"; +module.exports.hash = "dd68210585b112824dac825c061cb917"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('///providers/Microsoft.Authorization/roleDefinitions') + .get('///providers/Microsoft.Authorization/roleAssignments') .query(true) .reply(401, "OK", [ 'content-type', 'application/json; charset=utf-8', 'x-content-type-options', 'nosniff', 'www-authenticate', - 'Bearer authorization="https://login.windows-ppe.net/01ea9a65-813e-4238-8204-bf7328d63fc6", resource="https://managedhsm-int.azure-int.net"', + 'Bearer authorization="https://login.windows-ppe.net/azure_tenant_id", resource="https://managedhsm-int.azure-int.net"', 'x-frame-options', 'SAMEORIGIN', 'content-length', '2', 'x-ms-request-id', - '47087520-ec74-11ea-be1e-0242ac120005', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', 'default-src \'self\'', 'x-ms-build-version', - '1.0.20200901-1-40187cd0-develop', + '1.0.20200909-2-c73be597-develop', 'cache-control', 'no-cache', 'x-ms-server-latency', '1' ]); +nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) + .get('///providers/Microsoft.Authorization/roleAssignments') + .query(true) + .reply(200, {"value":[{"id":"/providers/Microsoft.Authorization/roleAssignments/8e7fe831-35fe-0488-beaf-5b0866306cbb","name":"8e7fe831-35fe-0488-beaf-5b0866306cbb","properties":{"principalId":"4f584d72-47b3-48d1-971c-ce0ae8a47560","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/65e1be51-aa38-4250-967a-8658fdfb260b","name":"65e1be51-aa38-4250-967a-8658fdfb260b","properties":{"principalId":"49acc88b-8f9e-4619-9856-16691db66767","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/967a0ebd-73a1-0145-85fc-3b6514ac2581","name":"967a0ebd-73a1-0145-85fc-3b6514ac2581","properties":{"principalId":"e7941875-b7e4-4ba2-9527-d3ef2a9b58fa","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1d8e08be-5415-4c5f-94f2-22ba4f889ef7","name":"1d8e08be-5415-4c5f-94f2-22ba4f889ef7","properties":{"principalId":"c2101ce9-648a-4bbe-8f0e-3e891ff1658d","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1587adcd-1227-4799-03dc-a4194c659c07","name":"1587adcd-1227-4799-03dc-a4194c659c07","properties":{"principalId":"2bca474d-4fac-495d-919a-30376e0fe515","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/129c2001-45e7-0814-13d0-9d933e794b37","name":"129c2001-45e7-0814-13d0-9d933e794b37","properties":{"principalId":"d0596a07-8d8d-433f-a25e-5c6f46787784","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}]}, [ 'x-frame-options', + 'SAMEORIGIN', + 'x-ms-request-id', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + 'content-type', + 'application/json; charset=utf-8', + 'x-ms-keyvault-region', + 'EASTUS', + 'content-length', + '2405', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'content-security-policy', + 'default-src \'self\'', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '1' ]); + nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .get('///providers/Microsoft.Authorization/roleDefinitions') .query(true) .reply(200, {"value":[{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","name":"a290e904-7015-4bba-90c8-60543313cdb4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete","Microsoft.KeyVault/managedHsm/securitydomain/download/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/read","Microsoft.KeyVault/managedHsm/securitydomain/transferkey/read","Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/restore/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/restore/status/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/515eb02d-2335-4d2d-92f2-b1cbdf9c3778","name":"515eb02d-2335-4d2d-92f2-b1cbdf9c3778","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Officer","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/21dbd100-6940-42c2-9190-5d6cb909625b","name":"21dbd100-6940-42c2-9190-5d6cb909625b","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto User","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/4bd23610-cdcf-4971-bdee-bdc562cc28e4","name":"4bd23610-cdcf-4971-bdee-bdc562cc28e4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Policy Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","name":"2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Auditor","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/33413926-3206-4cdd-b39a-83574fe37a17","name":"33413926-3206-4cdd-b39a-83574fe37a17","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Service Encryption","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","name":"7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/keys/backup/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Backup","type":""},"type":"Microsoft.Authorization/roleDefinitions"}]}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '47087520-ec74-11ea-be1e-0242ac120005', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -52,23 +80,23 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-content-type-options', 'nosniff', 'x-ms-build-version', - '1.0.20200901-1-40187cd0-develop', + '1.0.20200909-2-c73be597-develop', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '2' ]); + '0' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .put('///providers/Microsoft.Authorization/roleAssignments/06217763-9724-4b26-9eed-c7ab7f90897d', {"properties":{"roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6"}}) + .put('///providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27', {"properties":{"roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6"}}) .query(true) - .reply(201, {"id":"/providers/Microsoft.Authorization/roleAssignments/06217763-9724-4b26-9eed-c7ab7f90897d","name":"06217763-9724-4b26-9eed-c7ab7f90897d","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'content-type', + .reply(201, {"id":"/providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27","name":"b36b00af-89c6-435f-a43d-9a3087015c27","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'content-type', 'application/json; charset=utf-8', 'x-content-type-options', 'nosniff', 'content-length', '398', 'x-ms-request-id', - '47087520-ec74-11ea-be1e-0242ac120005', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -78,19 +106,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '271', + '300', 'cache-control', 'no-cache', 'x-frame-options', 'SAMEORIGIN' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('///providers/Microsoft.Authorization/roleAssignments/06217763-9724-4b26-9eed-c7ab7f90897d') + .get('///providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27') .query(true) - .reply(200, {"id":"/providers/Microsoft.Authorization/roleAssignments/06217763-9724-4b26-9eed-c7ab7f90897d","name":"06217763-9724-4b26-9eed-c7ab7f90897d","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'x-frame-options', + .reply(200, {"id":"/providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27","name":"b36b00af-89c6-435f-a43d-9a3087015c27","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '47087520-ec74-11ea-be1e-0242ac120005', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -106,23 +134,23 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-content-type-options', 'nosniff', 'x-ms-build-version', - '1.0.20200901-1-40187cd0-develop', + '1.0.20200909-2-c73be597-develop', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '0' ]); + '1' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .delete('///providers/Microsoft.Authorization/roleAssignments/06217763-9724-4b26-9eed-c7ab7f90897d') + .delete('///providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27') .query(true) - .reply(200, {"id":"/providers/Microsoft.Authorization/roleAssignments/06217763-9724-4b26-9eed-c7ab7f90897d","name":"06217763-9724-4b26-9eed-c7ab7f90897d","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'content-type', + .reply(200, {"id":"/providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27","name":"b36b00af-89c6-435f-a43d-9a3087015c27","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'content-type', 'application/json; charset=utf-8', 'x-content-type-options', 'nosniff', 'content-length', '398', 'x-ms-request-id', - '47087520-ec74-11ea-be1e-0242ac120005', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -132,7 +160,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '310', + '259', 'cache-control', 'no-cache', 'x-frame-options', diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_deleteroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_deleteroleassignment.js deleted file mode 100644 index 19154c1c05df..000000000000 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_deleteroleassignment.js +++ /dev/null @@ -1,5 +0,0 @@ -let nock = require('nock'); - -module.exports.hash = "99382fa0c361c974022b4b2c0d109ef6"; - -module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_getroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_getroleassignment.js deleted file mode 100644 index 36f52fd0a510..000000000000 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_getroleassignment.js +++ /dev/null @@ -1,5 +0,0 @@ -let nock = require('nock'); - -module.exports.hash = "329719357f7fccd7c4cfb263526ca40f"; - -module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroleassignments.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroleassignments.js new file mode 100644 index 000000000000..b745b7359e71 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroleassignments.js @@ -0,0 +1,59 @@ +let nock = require('nock'); + +module.exports.hash = "40a7c9b72f55641675802c7541f1b95b"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) + .get('///providers/Microsoft.Authorization/roleAssignments') + .query(true) + .reply(401, "OK", [ 'content-type', + 'application/json; charset=utf-8', + 'x-content-type-options', + 'nosniff', + 'www-authenticate', + 'Bearer authorization="https://login.windows-ppe.net/azure_tenant_id", resource="https://managedhsm-int.azure-int.net"', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '2', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'content-security-policy', + 'default-src \'self\'', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'cache-control', + 'no-cache', + 'x-ms-server-latency', + '1' ]); + +nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) + .get('///providers/Microsoft.Authorization/roleAssignments') + .query(true) + .reply(200, {"value":[{"id":"/providers/Microsoft.Authorization/roleAssignments/8e7fe831-35fe-0488-beaf-5b0866306cbb","name":"8e7fe831-35fe-0488-beaf-5b0866306cbb","properties":{"principalId":"4f584d72-47b3-48d1-971c-ce0ae8a47560","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/65e1be51-aa38-4250-967a-8658fdfb260b","name":"65e1be51-aa38-4250-967a-8658fdfb260b","properties":{"principalId":"49acc88b-8f9e-4619-9856-16691db66767","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/967a0ebd-73a1-0145-85fc-3b6514ac2581","name":"967a0ebd-73a1-0145-85fc-3b6514ac2581","properties":{"principalId":"e7941875-b7e4-4ba2-9527-d3ef2a9b58fa","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1d8e08be-5415-4c5f-94f2-22ba4f889ef7","name":"1d8e08be-5415-4c5f-94f2-22ba4f889ef7","properties":{"principalId":"c2101ce9-648a-4bbe-8f0e-3e891ff1658d","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1587adcd-1227-4799-03dc-a4194c659c07","name":"1587adcd-1227-4799-03dc-a4194c659c07","properties":{"principalId":"2bca474d-4fac-495d-919a-30376e0fe515","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/129c2001-45e7-0814-13d0-9d933e794b37","name":"129c2001-45e7-0814-13d0-9d933e794b37","properties":{"principalId":"d0596a07-8d8d-433f-a25e-5c6f46787784","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}]}, [ 'x-frame-options', + 'SAMEORIGIN', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-ms-keyvault-region', + 'EASTUS', + 'content-length', + '2405', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'content-security-policy', + 'default-src \'self\'', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '1' ]); diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroledefinitions.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroledefinitions.js index 7b9a2ef0b4a6..68899afe0b8d 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroledefinitions.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroledefinitions.js @@ -1,6 +1,6 @@ let nock = require('nock'); -module.exports.hash = "ebc59ef20346d706f1dbe9e323c9290d"; +module.exports.hash = "d61a5b81560a7e21eb384041c75fb8db"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} @@ -18,13 +18,13 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '2', 'x-ms-request-id', - '47087520-ec74-11ea-be1e-0242ac120005', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', 'default-src \'self\'', 'x-ms-build-version', - '1.0.20200901-1-40187cd0-develop', + '1.0.20200909-2-c73be597-develop', 'cache-control', 'no-cache', 'x-ms-server-latency', @@ -36,7 +36,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded .reply(200, {"value":[{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","name":"a290e904-7015-4bba-90c8-60543313cdb4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete","Microsoft.KeyVault/managedHsm/securitydomain/download/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/read","Microsoft.KeyVault/managedHsm/securitydomain/transferkey/read","Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/restore/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/restore/status/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/515eb02d-2335-4d2d-92f2-b1cbdf9c3778","name":"515eb02d-2335-4d2d-92f2-b1cbdf9c3778","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Officer","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/21dbd100-6940-42c2-9190-5d6cb909625b","name":"21dbd100-6940-42c2-9190-5d6cb909625b","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto User","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/4bd23610-cdcf-4971-bdee-bdc562cc28e4","name":"4bd23610-cdcf-4971-bdee-bdc562cc28e4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Policy Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","name":"2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Auditor","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/33413926-3206-4cdd-b39a-83574fe37a17","name":"33413926-3206-4cdd-b39a-83574fe37a17","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Service Encryption","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","name":"7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/keys/backup/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Backup","type":""},"type":"Microsoft.Authorization/roleDefinitions"}]}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '47087520-ec74-11ea-be1e-0242ac120005', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -52,7 +52,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-content-type-options', 'nosniff', 'x-ms-build-version', - '1.0.20200901-1-40187cd0-develop', + '1.0.20200909-2-c73be597-develop', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js index 70f9ce320f74..cc56fcb1de05 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js @@ -10,17 +10,17 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded .reply(401, "", [ 'content-type', 'application/json; charset=utf-8', 'x-ms-server-latency', - '2', + '126', 'x-content-type-options', 'nosniff', 'www-authenticate', - 'Bearer authorization="https://login.windows-ppe.net/01ea9a65-813e-4238-8204-bf7328d63fc6", resource="https://managedhsm-int.azure-int.net"', + 'Bearer authorization="https://login.windows-ppe.net/azure_tenant_id", resource="https://managedhsm-int.azure-int.net"', 'x-frame-options', 'SAMEORIGIN', 'content-length', '0', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -31,22 +31,22 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) - .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599226645,"endTime":null,"jobId":"bf6dcbae3b3b407b98a2998b8d434351","azureStorageBlobContainerUri":null}, [ 'server', + .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599748973,"endTime":null,"jobId":"5346496aa0434106be3bdf238270a71b","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', 'date', - 'Fri, 04 Sep 2020 13:37:25 GMT', + 'Thu, 10 Sep 2020 14:42:53 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/backup/bf6dcbae3b3b407b98a2998b8d434351/pending', + 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/backup/5346496aa0434106be3bdf238270a71b/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', '10', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -54,7 +54,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '3127', + '1030', 'content-length', '216', 'strict-transport-security', @@ -63,14 +63,14 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/bf6dcbae3b3b407b98a2998b8d434351/pending') + .get('/backup/5346496aa0434106be3bdf238270a71b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"bf6dcbae3b3b407b98a2998b8d434351","startTime":1599226645,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:37:26 GMT', + 'Thu, 10 Sep 2020 14:42:54 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -78,7 +78,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -90,19 +90,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '677', + '729', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/bf6dcbae3b3b407b98a2998b8d434351/pending') + .get('/backup/5346496aa0434106be3bdf238270a71b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"bf6dcbae3b3b407b98a2998b8d434351","startTime":1599226645,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:37:26 GMT', + 'Thu, 10 Sep 2020 14:42:54 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -110,7 +110,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -122,19 +122,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '628', + '679', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/bf6dcbae3b3b407b98a2998b8d434351/pending') + .get('/backup/5346496aa0434106be3bdf238270a71b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"bf6dcbae3b3b407b98a2998b8d434351","startTime":1599226645,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:37:31 GMT', + 'Thu, 10 Sep 2020 14:42:57 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -142,7 +142,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -154,19 +154,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '1525', + '641', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/bf6dcbae3b3b407b98a2998b8d434351/pending') + .get('/backup/5346496aa0434106be3bdf238270a71b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"bf6dcbae3b3b407b98a2998b8d434351","startTime":1599226645,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:37:33 GMT', + 'Thu, 10 Sep 2020 14:43:00 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -174,7 +174,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -186,19 +186,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '1201', + '681', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/bf6dcbae3b3b407b98a2998b8d434351/pending') + .get('/backup/5346496aa0434106be3bdf238270a71b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"bf6dcbae3b3b407b98a2998b8d434351","startTime":1599226645,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014425336","endTime":1599748983,"error":null,"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:37:37 GMT', + 'Thu, 10 Sep 2020 14:43:03 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -206,39 +206,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', - 'content-type', - 'application/json; charset=utf-8', - 'x-frame-options', - 'SAMEORIGIN', - 'content-length', - '216', - 'strict-transport-security', - 'max-age=31536000; includeSubDomains', - 'x-ms-keyvault-network-info', - 'addr=108.226.109.105', - 'x-ms-server-latency', - '584', - 'content-security-policy', - 'default-src \'self\'' ]); - -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/bf6dcbae3b3b407b98a2998b8d434351/pending') - .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/mhsm-keyvault_name-2020090413372583","endTime":1599226659,"error":null,"jobId":"bf6dcbae3b3b407b98a2998b8d434351","startTime":1599226645,"status":"Succeeded","statusDetails":null}, [ 'server', - 'Kestrel', - 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', - 'date', - 'Fri, 04 Sep 2020 13:37:39 GMT', - 'cache-control', - 'no-cache', - 'x-content-type-options', - 'nosniff', - 'x-ms-keyvault-region', - 'EASTUS', - 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -250,6 +218,6 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '627', + '641', 'content-security-policy', 'default-src \'self\'' ]); diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js index 19b7d329917a..bc7306de9f11 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js @@ -14,13 +14,13 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-content-type-options', 'nosniff', 'www-authenticate', - 'Bearer authorization="https://login.windows-ppe.net/01ea9a65-813e-4238-8204-bf7328d63fc6", resource="https://managedhsm-int.azure-int.net"', + 'Bearer authorization="https://login.windows-ppe.net/azure_tenant_id", resource="https://managedhsm-int.azure-int.net"', 'x-frame-options', 'SAMEORIGIN', 'content-length', '0', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -31,22 +31,22 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) - .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599226672,"endTime":null,"jobId":"3b6fd673a64144b1bc6c8c9979cf2d2f","azureStorageBlobContainerUri":null}, [ 'server', + .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599748998,"endTime":null,"jobId":"01d247c294db47229eefb189ba0b8982","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', 'date', - 'Fri, 04 Sep 2020 13:37:52 GMT', + 'Thu, 10 Sep 2020 14:43:18 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/backup/3b6fd673a64144b1bc6c8c9979cf2d2f/pending', + 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/backup/01d247c294db47229eefb189ba0b8982/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', '10', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -54,7 +54,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '889', + '972', 'content-length', '216', 'strict-transport-security', @@ -63,14 +63,14 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/3b6fd673a64144b1bc6c8c9979cf2d2f/pending') + .get('/backup/01d247c294db47229eefb189ba0b8982/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"3b6fd673a64144b1bc6c8c9979cf2d2f","startTime":1599226672,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:37:52 GMT', + 'Thu, 10 Sep 2020 14:43:18 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -78,7 +78,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -90,19 +90,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '585', + '678', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/3b6fd673a64144b1bc6c8c9979cf2d2f/pending') + .get('/backup/01d247c294db47229eefb189ba0b8982/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"3b6fd673a64144b1bc6c8c9979cf2d2f","startTime":1599226672,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:37:53 GMT', + 'Thu, 10 Sep 2020 14:43:19 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -110,7 +110,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -122,19 +122,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '552', + '639', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/3b6fd673a64144b1bc6c8c9979cf2d2f/pending') + .get('/backup/01d247c294db47229eefb189ba0b8982/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"3b6fd673a64144b1bc6c8c9979cf2d2f","startTime":1599226672,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:37:56 GMT', + 'Thu, 10 Sep 2020 14:43:22 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -142,7 +142,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -154,19 +154,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '611', + '654', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/3b6fd673a64144b1bc6c8c9979cf2d2f/pending') + .get('/backup/01d247c294db47229eefb189ba0b8982/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"3b6fd673a64144b1bc6c8c9979cf2d2f","startTime":1599226672,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:37:58 GMT', + 'Thu, 10 Sep 2020 14:43:25 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -174,7 +174,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -186,19 +186,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '578', + '620', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/3b6fd673a64144b1bc6c8c9979cf2d2f/pending') + .get('/backup/01d247c294db47229eefb189ba0b8982/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"3b6fd673a64144b1bc6c8c9979cf2d2f","startTime":1599226672,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014431833","endTime":1599749008,"error":null,"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:38:00 GMT', + 'Thu, 10 Sep 2020 14:43:28 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -206,84 +206,84 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', 'SAMEORIGIN', 'content-length', - '216', + '257', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '550', + '627', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/3b6fd673a64144b1bc6c8c9979cf2d2f/pending') + .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folderToRestore":"https://chrissprim.blob.core.windows.net/backup"}) .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/mhsm-keyvault_name-2020090413375249","endTime":1599226683,"error":null,"jobId":"3b6fd673a64144b1bc6c8c9979cf2d2f","startTime":1599226672,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"56bbbdab421c4fadb3592a2fc23fcf9c","startTime":1599749010,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', - 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', 'date', - 'Fri, 04 Sep 2020 13:38:04 GMT', + 'Thu, 10 Sep 2020 14:43:30 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', + 'azure-asyncoperation', + 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/restore/56bbbdab421c4fadb3592a2fc23fcf9c/pending', 'x-ms-keyvault-region', 'EASTUS', + 'retry-after', + '10', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', 'SAMEORIGIN', - 'content-length', - '257', - 'strict-transport-security', - 'max-age=31536000; includeSubDomains', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '647', + '823', + 'content-length', + '180', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folderToRestore":"https://chrissprim.blob.core.windows.net/backup"}) + .get('/backup/56bbbdab421c4fadb3592a2fc23fcf9c/pending') .query(true) - .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"928034973f004fe8b203438bda65e9db","startTime":1599226685,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/https://chrissprim.blob.core.windows.net/backup","endTime":1599749010,"error":{"code":null,"innererror":null,"message":null},"jobId":"56bbbdab421c4fadb3592a2fc23fcf9c","startTime":1599749010,"status":"Failed","statusDetails":"Invalid backup provided"}, [ 'server', 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:38:05 GMT', + 'Thu, 10 Sep 2020 14:43:30 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', - 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/restore/928034973f004fe8b203438bda65e9db/pending', 'x-ms-keyvault-region', 'EASTUS', - 'retry-after', - '10', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', 'SAMEORIGIN', - 'x-ms-keyvault-network-info', - 'addr=108.226.109.105', - 'x-ms-server-latency', - '954', 'content-length', - '180', + '332', 'strict-transport-security', 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '637', 'content-security-policy', 'default-src \'self\'' ]); diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js index 8334168ed0b9..dd103b711f83 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js @@ -1,6 +1,6 @@ let nock = require('nock'); -module.exports.hash = "690ecdb1b5a57d5389d6d9893184386b"; +module.exports.hash = "908147e0f531c6948ff29890bdb04724"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} @@ -14,13 +14,13 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-content-type-options', 'nosniff', 'www-authenticate', - 'Bearer authorization="https://login.windows-ppe.net/01ea9a65-813e-4238-8204-bf7328d63fc6", resource="https://managedhsm-int.azure-int.net"', + 'Bearer authorization="https://login.windows-ppe.net/azure_tenant_id", resource="https://managedhsm-int.azure-int.net"', 'x-frame-options', 'SAMEORIGIN', 'content-length', '0', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -31,14 +31,14 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .post('/keys/beginBackupthenbeginSelectiveRestore/create', {"kty":"RSA"}) .query(true) - .reply(200, {"attributes":{"created":1599226697,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599226697},"key":{"e":"AQAB","key_ops":["wrapKey","decrypt","encrypt","unwrapKey","sign","verify"],"kid":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/keys/beginBackupthenbeginSelectiveRestore/7ff5835071980e2f8bdb2a9303962da2","kty":"RSA-HSM","n":"qCgXoJM6FiJTFZkUhHjBNoZSs28cur7ReNJer9U3WdxX9hs8VHTCjZM853swj2x5YjkznL7bjQhK5fEP-3nN9jwqs0f6VMQrObtM1qXmdbX0yx-xBp4A5g9qxENznf7iZe_dGDT3naoaTZUNEcyW3x1loQ1HnXQLyJ5kSDl5Gg_m58l7z9otw2IaKohBAMgdV9rlUTTcc9i6LRuUF24-bQt9_pdLDvE9VpX60Gs-y1xTWPRa4nPgDhkmPMSK5EDalk3PZiRdtDo5BeZpuLGRa8V5SpqbGziziDwca0KnuJxc-mSOK0OtEuLiZULPSRwMGWc4BmdtKYT9iIsu7r2N8w"}}, [ 'content-type', + .reply(200, {"attributes":{"created":1599749024,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599749024},"key":{"e":"AQAB","key_ops":["wrapKey","decrypt","encrypt","unwrapKey","sign","verify"],"kid":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/keys/beginBackupthenbeginSelectiveRestore/13cd12b2b86401872fb5828577ec40bb","kty":"RSA-HSM","n":"i5UMbpILEmoGVyS-WpzaloXsUjfhlQ9ss7yemxOGghcT6z2rXblAm3ZXvglrrz7CN_u0qZ_3246gG7Yr6EM-x6hDNgpLOBVMiUHAubp75cDqC14RNis9J16nnhmfTw3cMdvk9w2Tf4iIl7UrwQTXen-yPnoGrixvIBGrTPX-9cheOASXodEqCGaoZi0YyPc0XP0-_efs_QVqQCy6a6HJifndaQlvQ0u0kj_9jqGI4zYm0deaAxHsRYpO7p0Ae7qOPgn4TmmDPvYPdLo5PdtOjGEuVnhA3DPSuwV7jKJtOLRdkch3QBzMVkg1_ChErnE2RKY3afiQF1QKfVbbqdYCCw"}}, [ 'content-type', 'application/json; charset=utf-8', 'x-content-type-options', 'nosniff', 'content-length', '755', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -48,7 +48,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '682', + '693', 'cache-control', 'no-cache', 'x-frame-options', @@ -64,13 +64,13 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-content-type-options', 'nosniff', 'www-authenticate', - 'Bearer authorization="https://login.windows-ppe.net/01ea9a65-813e-4238-8204-bf7328d63fc6", resource="https://managedhsm-int.azure-int.net"', + 'Bearer authorization="https://login.windows-ppe.net/azure_tenant_id", resource="https://managedhsm-int.azure-int.net"', 'x-frame-options', 'SAMEORIGIN', 'content-length', '0', 'x-ms-request-id', - '3afdb3e2-ee38-11ea-8011-0242ac120004', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -81,22 +81,22 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) - .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599226710,"endTime":null,"jobId":"9c1ab31ae44c4cf09ac1b5bfe88b5e4f","azureStorageBlobContainerUri":null}, [ 'server', + .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599749038,"endTime":null,"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', 'date', - 'Fri, 04 Sep 2020 13:38:29 GMT', + 'Thu, 10 Sep 2020 14:43:58 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/backup/9c1ab31ae44c4cf09ac1b5bfe88b5e4f/pending', + 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', '10', 'x-ms-request-id', - '3afdb3e2-ee38-11ea-8011-0242ac120004', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -104,7 +104,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '969', + '838', 'content-length', '216', 'strict-transport-security', @@ -113,14 +113,14 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/9c1ab31ae44c4cf09ac1b5bfe88b5e4f/pending') + .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"9c1ab31ae44c4cf09ac1b5bfe88b5e4f","startTime":1599226710,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:38:30 GMT', + 'Thu, 10 Sep 2020 14:43:59 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -128,7 +128,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '3afdb3e2-ee38-11ea-8011-0242ac120004', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -140,19 +140,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '619', + '755', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/9c1ab31ae44c4cf09ac1b5bfe88b5e4f/pending') + .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"9c1ab31ae44c4cf09ac1b5bfe88b5e4f","startTime":1599226710,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:38:31 GMT', + 'Thu, 10 Sep 2020 14:44:00 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -160,7 +160,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '3afdb3e2-ee38-11ea-8011-0242ac120004', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -172,19 +172,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '537', + '653', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/9c1ab31ae44c4cf09ac1b5bfe88b5e4f/pending') + .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"9c1ab31ae44c4cf09ac1b5bfe88b5e4f","startTime":1599226710,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:38:34 GMT', + 'Thu, 10 Sep 2020 14:44:02 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -192,7 +192,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '3afdb3e2-ee38-11ea-8011-0242ac120004', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -204,19 +204,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '606', + '645', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/9c1ab31ae44c4cf09ac1b5bfe88b5e4f/pending') + .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"9c1ab31ae44c4cf09ac1b5bfe88b5e4f","startTime":1599226710,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:38:36 GMT', + 'Thu, 10 Sep 2020 14:44:05 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -224,7 +224,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '3afdb3e2-ee38-11ea-8011-0242ac120004', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -236,19 +236,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '528', + '653', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/9c1ab31ae44c4cf09ac1b5bfe88b5e4f/pending') + .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"9c1ab31ae44c4cf09ac1b5bfe88b5e4f","startTime":1599226710,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:38:39 GMT', + 'Thu, 10 Sep 2020 14:44:08 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -256,7 +256,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '3afdb3e2-ee38-11ea-8011-0242ac120004', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -268,19 +268,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '538', + '661', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/9c1ab31ae44c4cf09ac1b5bfe88b5e4f/pending') + .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/mhsm-keyvault_name-2020090413383071","endTime":1599226722,"error":null,"jobId":"9c1ab31ae44c4cf09ac1b5bfe88b5e4f","startTime":1599226710,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014435852","endTime":1599749049,"error":null,"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'date', - 'Fri, 04 Sep 2020 13:38:42 GMT', + 'Thu, 10 Sep 2020 14:44:11 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -288,7 +288,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '3afdb3e2-ee38-11ea-8011-0242ac120004', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -300,29 +300,29 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '526', + '634', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .put('/keys/beginBackupthenbeginSelectiveRestore/restore', {"sasTokenParameters":{"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folder":"https://chrissprim.blob.core.windows.net/backup"}) .query(true) - .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"ae2bf388a4dd471885cd2b247ed5e0f9","startTime":1599226723,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"2e7e281982334c0ca84186d8f6f40cca","startTime":1599749052,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'date', - 'Fri, 04 Sep 2020 13:38:42 GMT', + 'Thu, 10 Sep 2020 14:44:12 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/restore/ae2bf388a4dd471885cd2b247ed5e0f9/pending', + 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/restore/2e7e281982334c0ca84186d8f6f40cca/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', '10', 'x-ms-request-id', - '3afdb3e2-ee38-11ea-8011-0242ac120004', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -330,7 +330,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '749', + '903', 'content-length', '180', 'strict-transport-security', @@ -341,14 +341,14 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .delete('/keys/beginBackupthenbeginSelectiveRestore') .query(true) - .reply(200, {"attributes":{"created":1599226697,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599226697},"deletedDate":1599226724,"key":{"e":"AQAB","key_ops":["wrapKey","verify","sign","unwrapKey","decrypt","encrypt"],"kid":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/keys/beginBackupthenbeginSelectiveRestore/7ff5835071980e2f8bdb2a9303962da2","kty":"RSA-HSM","n":"qCgXoJM6FiJTFZkUhHjBNoZSs28cur7ReNJer9U3WdxX9hs8VHTCjZM853swj2x5YjkznL7bjQhK5fEP-3nN9jwqs0f6VMQrObtM1qXmdbX0yx-xBp4A5g9qxENznf7iZe_dGDT3naoaTZUNEcyW3x1loQ1HnXQLyJ5kSDl5Gg_m58l7z9otw2IaKohBAMgdV9rlUTTcc9i6LRuUF24-bQt9_pdLDvE9VpX60Gs-y1xTWPRa4nPgDhkmPMSK5EDalk3PZiRdtDo5BeZpuLGRa8V5SpqbGziziDwca0KnuJxc-mSOK0OtEuLiZULPSRwMGWc4BmdtKYT9iIsu7r2N8w"},"recoveryId":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1599831524}, [ 'content-type', + .reply(200, {"attributes":{"created":1599749024,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599749024},"deletedDate":1599749053,"key":{"e":"AQAB","key_ops":["wrapKey","verify","sign","unwrapKey","decrypt","encrypt"],"kid":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/keys/beginBackupthenbeginSelectiveRestore/13cd12b2b86401872fb5828577ec40bb","kty":"RSA-HSM","n":"i5UMbpILEmoGVyS-WpzaloXsUjfhlQ9ss7yemxOGghcT6z2rXblAm3ZXvglrrz7CN_u0qZ_3246gG7Yr6EM-x6hDNgpLOBVMiUHAubp75cDqC14RNis9J16nnhmfTw3cMdvk9w2Tf4iIl7UrwQTXen-yPnoGrixvIBGrTPX-9cheOASXodEqCGaoZi0YyPc0XP0-_efs_QVqQCy6a6HJifndaQlvQ0u0kj_9jqGI4zYm0deaAxHsRYpO7p0Ae7qOPgn4TmmDPvYPdLo5PdtOjGEuVnhA3DPSuwV7jKJtOLRdkch3QBzMVkg1_ChErnE2RKY3afiQF1QKfVbbqdYCCw"},"recoveryId":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1600353853}, [ 'content-type', 'application/json; charset=utf-8', 'x-content-type-options', 'nosniff', 'content-length', '932', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -358,7 +358,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '833', + '456', 'cache-control', 'no-cache', 'x-frame-options', @@ -367,10 +367,10 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .get('/deletedkeys/beginBackupthenbeginSelectiveRestore') .query(true) - .reply(200, {"attributes":{"created":1599226697,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599226697},"deletedDate":1599226723,"key":{"e":"AQAB","key_ops":["encrypt","decrypt","unwrapKey","sign","verify","wrapKey"],"kid":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/keys/beginBackupthenbeginSelectiveRestore/7ff5835071980e2f8bdb2a9303962da2","kty":"RSA-HSM","n":"qCgXoJM6FiJTFZkUhHjBNoZSs28cur7ReNJer9U3WdxX9hs8VHTCjZM853swj2x5YjkznL7bjQhK5fEP-3nN9jwqs0f6VMQrObtM1qXmdbX0yx-xBp4A5g9qxENznf7iZe_dGDT3naoaTZUNEcyW3x1loQ1HnXQLyJ5kSDl5Gg_m58l7z9otw2IaKohBAMgdV9rlUTTcc9i6LRuUF24-bQt9_pdLDvE9VpX60Gs-y1xTWPRa4nPgDhkmPMSK5EDalk3PZiRdtDo5BeZpuLGRa8V5SpqbGziziDwca0KnuJxc-mSOK0OtEuLiZULPSRwMGWc4BmdtKYT9iIsu7r2N8w"},"recoveryId":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1599831523}, [ 'x-frame-options', + .reply(200, {"attributes":{"created":1599749024,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599749024},"deletedDate":1599749053,"key":{"e":"AQAB","key_ops":["encrypt","decrypt","unwrapKey","sign","verify","wrapKey"],"kid":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/keys/beginBackupthenbeginSelectiveRestore/13cd12b2b86401872fb5828577ec40bb","kty":"RSA-HSM","n":"i5UMbpILEmoGVyS-WpzaloXsUjfhlQ9ss7yemxOGghcT6z2rXblAm3ZXvglrrz7CN_u0qZ_3246gG7Yr6EM-x6hDNgpLOBVMiUHAubp75cDqC14RNis9J16nnhmfTw3cMdvk9w2Tf4iIl7UrwQTXen-yPnoGrixvIBGrTPX-9cheOASXodEqCGaoZi0YyPc0XP0-_efs_QVqQCy6a6HJifndaQlvQ0u0kj_9jqGI4zYm0deaAxHsRYpO7p0Ae7qOPgn4TmmDPvYPdLo5PdtOjGEuVnhA3DPSuwV7jKJtOLRdkch3QBzMVkg1_ChErnE2RKY3afiQF1QKfVbbqdYCCw"},"recoveryId":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1600353853}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -386,11 +386,11 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-content-type-options', 'nosniff', 'x-ms-build-version', - '1.0.20200903-1-42b8eab8-develop', + '1.0.20200909-2-c73be597-develop', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '171' ]); + '194' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .delete('/deletedkeys/beginBackupthenbeginSelectiveRestore') @@ -402,7 +402,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '0', 'x-ms-request-id', - '6f025072-ee3c-11ea-b181-0242ac120006', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -412,7 +412,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '655', + '597', 'cache-control', 'no-cache', 'x-frame-options', diff --git a/sdk/keyvault/keyvault-admin/src/lro/backup/operation.ts b/sdk/keyvault/keyvault-admin/src/lro/backup/operation.ts index 3c06ea0b6639..f39bc4c7b1d2 100644 --- a/sdk/keyvault/keyvault-admin/src/lro/backup/operation.ts +++ b/sdk/keyvault/keyvault-admin/src/lro/backup/operation.ts @@ -151,7 +151,15 @@ async function update( } }); - const { startTime, jobId, azureStorageBlobContainerUri, endTime, error } = serviceOperation; + const { + startTime, + jobId, + azureStorageBlobContainerUri, + endTime, + error, + status, + statusDetails + } = serviceOperation; if (!startTime) { state.error = new Error(`Missing "startTime" from the full backup operation.`); @@ -163,8 +171,8 @@ async function update( state.jobId = jobId; state.endTime = endTime; state.startTime = startTime; - state.status = serviceOperation.status; - state.statusDetails = serviceOperation.statusDetails; + state.status = status; + state.statusDetails = statusDetails; state.result = azureStorageBlobContainerUri; if (endTime) { diff --git a/sdk/keyvault/keyvault-admin/src/lro/restore/operation.ts b/sdk/keyvault/keyvault-admin/src/lro/restore/operation.ts index b8d5d8716a42..8a55182f8e14 100644 --- a/sdk/keyvault/keyvault-admin/src/lro/restore/operation.ts +++ b/sdk/keyvault/keyvault-admin/src/lro/restore/operation.ts @@ -157,7 +157,7 @@ async function update( } }); - const { startTime, jobId, endTime, error } = serviceOperation; + const { startTime, jobId, endTime, error, status, statusDetails } = serviceOperation; if (!startTime) { state.error = new Error(`Missing "startTime" from the full restore operation.`); @@ -169,8 +169,8 @@ async function update( state.jobId = jobId; state.endTime = endTime; state.startTime = startTime; - state.status = serviceOperation.status; - state.statusDetails = serviceOperation.statusDetails; + state.status = status; + state.statusDetails = statusDetails; if (endTime) { state.isCompleted = true; diff --git a/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts index 2938caab5123..8eca0c1d8577 100644 --- a/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts @@ -15,40 +15,44 @@ type ApIVersions = "7.2-preview"; describe("The keyvault-admin clients should set the serviceVersion", () => { const keyVaultUrl = `https://eastus2.keyvault_name.managedhsm-int.azure-int.net`; - describe("KeyVaultAccessControlClient", () => { - const mockHttpClient: HttpClient = { + function makeHTTPMock(path: string, status = 200): HttpClient { + return { async sendRequest(httpRequest: WebResourceLike): Promise { return { - status: 200, + status, headers: new HttpHeaders(), request: httpRequest, parsedBody: { - id: `${keyVaultUrl}/providers/Microsoft.Authorization/roleDefinitions`, + id: `${keyVaultUrl}${path}`, attributes: {} } }; } }; - - let sandbox: SinonSandbox; - let spy: SinonSpy<[WebResourceLike], Promise>; - let credential: ClientSecretCredential; - + } + + let mockHttpClient: HttpClient; + let sandbox: SinonSandbox; + let spy: SinonSpy<[WebResourceLike], Promise>; + let credential: ClientSecretCredential; + + afterEach(() => { + sandbox.restore(); + }); + + describe("KeyVaultAccessControlClient", () => { beforeEach(async () => { + mockHttpClient = makeHTTPMock("/providers/Microsoft.Authorization/roleDefinitions"); sandbox = createSandbox(); spy = sandbox.spy(mockHttpClient, "sendRequest"); - + credential = await new ClientSecretCredential( env.AZURE_TENANT_ID!, env.AZURE_CLIENT_ID!, env.AZURE_CLIENT_SECRET! ); }); - - afterEach(() => { - sandbox.restore(); - }); - + it("it should default to the latest API version", async function() { const client = new KeyVaultAccessControlClient(keyVaultUrl, credential, { httpClient: mockHttpClient @@ -84,45 +88,23 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { }); describe("KeyVaultBackupClient", () => { - const mockHttpClient: HttpClient = { - async sendRequest(httpRequest: WebResourceLike): Promise { - return { - status: 200, - headers: new HttpHeaders(), - request: httpRequest, - parsedBody: { - id: `${keyVaultUrl}/backup`, - attributes: {} - } - }; - } - }; - - let sandbox: SinonSandbox; - let spy: SinonSpy<[WebResourceLike], Promise>; - let credential: ClientSecretCredential; - beforeEach(async () => { + mockHttpClient = makeHTTPMock("/backup", 202); sandbox = createSandbox(); spy = sandbox.spy(mockHttpClient, "sendRequest"); - + credential = await new ClientSecretCredential( env.AZURE_TENANT_ID!, env.AZURE_CLIENT_ID!, env.AZURE_CLIENT_SECRET! ); }); - - afterEach(() => { - sandbox.restore(); - }); - + it("it should default to the latest API version", async function() { const client = new KeyVaultBackupClient(keyVaultUrl, credential, { httpClient: mockHttpClient }); - const backupPoller = await client.beginBackup("secretName", "value"); - await backupPoller.pollUntilDone(); + await client.beginBackup("secretName", "value"); const calls = spy.getCalls(); assert.equal(calls[0].args[0].url, `${keyVaultUrl}/backup?api-version=${LATEST_API_VERSION}`); @@ -139,8 +121,7 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { serviceVersion: serviceVersion as ApIVersions, httpClient: mockHttpClient }); - const backupPoller = await client.beginBackup("secretName", "value"); - await backupPoller.pollUntilDone(); + await client.beginBackup("secretName", "value"); const calls = spy.getCalls(); const lastCall = calls[calls.length - 1]; diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts index ad24207f4f07..fbd5246b3be0 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.aborts.spec.ts @@ -40,6 +40,19 @@ describe("Aborting KeyVaultAccessControlClient's requests", () => { }); }); + it("can abort listRoleAssignments", async function() { + const controller = new AbortController(); + controller.abort(); + + await assertThrowsAbortError(async () => { + await client + .listRoleAssignments("/", { + abortSignal: controller.signal + }) + .next(); + }); + }); + it("can abort createRoleAssignment", async function() { const roleDefinitionId = generateFakeUUID(); const name = generateFakeUUID(); diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts index 68c73a3d416f..84332c8eb740 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts @@ -30,7 +30,7 @@ describe("KeyVaultAccessControlClient", () => { const expectedType = "Microsoft.Authorization/roleDefinitions"; let receivedRoles: string[] = []; - for await (const roleDefinition of client.listRoleDefinitions("/")) { + for await (const roleDefinition of client.listRoleDefinitions(globalScope)) { // Each role definition will have the shape of: // // { @@ -53,17 +53,16 @@ describe("KeyVaultAccessControlClient", () => { const expectedType = "Microsoft.Authorization/roleAssignments"; let receivedRoles: string[] = []; - for await (const roleAssignment of client.listRoleAssignments("/")) { + for await (const roleAssignment of client.listRoleAssignments(globalScope)) { // Each role assignment will have the shape of: // // { - // id: 'Microsoft.KeyVault/providers/Microsoft.Authorization/roleAssignment/', + // id: '/providers/Microsoft.Authorization/roleAssignments/', // name: '', // type: '', // // ... // } // - console.log({ roleAssignment }); assert.equal(roleAssignment.type, expectedType); receivedRoles.push(roleAssignment.name); } @@ -72,9 +71,19 @@ describe("KeyVaultAccessControlClient", () => { assert.ok(receivedRoles.length); }); - it("createRoleAssignment and deleteRoleAssignment", async function() { + it("createRoleAssignment, getRoleAssignment and deleteRoleAssignment", async function() { + // First, deleting any existing assignment, just in case. + for await (const roleAssignment of client.listRoleAssignments(globalScope)) { + // Removing all roles from this object ID might kick us out of the system. + // IMPORTANT: Make sure CLIENT_OBJECT_ID isn't the Object ID of the principal used to authenticate. + if (roleAssignment.properties.principalId === env.CLIENT_OBJECT_ID) { + await client.deleteRoleAssignment(globalScope, roleAssignment.name); + } + } + const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; const name = generateFakeUUID(); + let assignment = await client.createRoleAssignment( globalScope, name, @@ -85,17 +94,7 @@ describe("KeyVaultAccessControlClient", () => { assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); assert.equal(assignment.properties?.principalId, env.CLIENT_OBJECT_ID); - assignment = await client.deleteRoleAssignment(globalScope, name); - assert.equal(assignment.name, name); - assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); - assert.equal(assignment.properties?.principalId, env.CLIENT_OBJECT_ID); - }); - - it("createRoleAssignment, getRoleAssignment and deleteRoleAssignment", async function() { - const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; - const name = generateFakeUUID(); - await client.createRoleAssignment(globalScope, name, roleDefinition.id!, env.CLIENT_OBJECT_ID); - let assignment = await client.getRoleAssignment(globalScope, name); + assignment = await client.getRoleAssignment(globalScope, name); assert.equal(assignment.name, name); assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); assert.equal(assignment.properties?.principalId, env.CLIENT_OBJECT_ID); diff --git a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts index ab566ac36f09..73b75d93116d 100644 --- a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts +++ b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts @@ -11,8 +11,14 @@ import { getKeyvaultName, getKeyVaultUrl } from "./common"; import { uniqueString } from "./recorder"; export async function authenticate(that: any): Promise { + const generatedUUIDs: string[] = []; function generateFakeUUID(): string { - return isPlaybackMode() ? "b36b00af-89c6-435f-a43d-9a3087015c27" : uuidv4(); + if (isPlaybackMode()) { + return "b36b00af-89c6-435f-a43d-9a3087015c27"; + } + const uuid = uuidv4(); + generatedUUIDs.push(uuid); + return uuid; } const secretSuffix = uniqueString(); @@ -23,18 +29,23 @@ export async function authenticate(that: any): Promise { AZURE_CLIENT_SECRET: "azure_client_secret", CLIENT_OBJECT_ID: "01ea9a65-813e-4238-8204-bf7328d63fc6", BLOB_STORAGE_SAS_TOKEN: "blob_storage_sas_token", - KEYVAULT_NAME: "keyvault_name" + KEYVAULT_NAME: "keyvault_name", + KEYVAULT_URI: "https://eastus2.keyvault_name.managedhsm-int.azure-int.net" }, customizationsOnRecordings: [ (recording: any): any => recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`), (recording: any): any => secretSuffix === "" ? recording : recording.replace(new RegExp(secretSuffix, "g"), ""), - (recording: any): any => - recording.replace( - /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/gi, - "b36b00af-89c6-435f-a43d-9a3087015c27" - ) // Fake UUID + (recording: any): any => { + for (const uuid of generatedUUIDs) { + recording = recording.replace( + new RegExp(uuid, "g"), + "b36b00af-89c6-435f-a43d-9a3087015c27" + ); + } + return recording; + } ], queryParametersToSkip: [] }; From 4baa40ee37a203f8691df922a22ec9f201180b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Thu, 10 Sep 2020 12:00:35 -0400 Subject: [PATCH 09/15] chai on the rollup.base --- sdk/keyvault/keyvault-admin/rollup.base.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/keyvault/keyvault-admin/rollup.base.config.js b/sdk/keyvault/keyvault-admin/rollup.base.config.js index 92e80dd9e81d..7e83d92eb0cc 100644 --- a/sdk/keyvault/keyvault-admin/rollup.base.config.js +++ b/sdk/keyvault/keyvault-admin/rollup.base.config.js @@ -66,7 +66,7 @@ export function nodeConfig(test = false) { // different output file baseConfig.output.file = "dist-test/index.node.js"; - baseConfig.external.push("assert", "fs", "path"); + baseConfig.external.push("assert", "fs", "path", "chai"); baseConfig.context = "null"; @@ -119,6 +119,7 @@ export function browserConfig(test = false) { }), cjs({ namedExports: { + chai: ["assert"], assert: ["ok", "equal", "strictEqual", "deepEqual"], "@opentelemetry/api": ["CanonicalCode", "SpanKind", "TraceFlags"] } From a87bb755c69819fcf1f46f16ceb98c8b764d369b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Thu, 10 Sep 2020 14:21:23 -0400 Subject: [PATCH 10/15] [Key Vault Admin] Docs and Samples (#11075) * WIP * some more content * README WIP * The readme seems good for a review * wip * the rest of the docs and samples for now * fixed references to keys * fixed bad path * fixed bad path references in kv-keys * feedback Addressed: - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485049017 Mentioning RBAC at least once per file. - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485050626 Adding the imports to the readme snippets. - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485051113 Declaring the vaultUrl variable in the other snippet in the main README for keyvault-admin. - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485051576 By expanding most of the references to KeyVaultRoleDefinition and KeyVaultRoleAssignment. - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485052069 by removing en-us from the URLs. - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485052392 by renaming the sample file backupHelloWorld.(js|ts) to backupRestoreHelloWorld.(js|ts) - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485052564 by renaming the sample file backupSelective.(js|ts) to backupSelectiveRestore.(js|ts). - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485053083 by getting a role assignment in the samples. - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485119474 By correctly referencing the link to core-lro in the main README. - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485120093 By fixing a syntax issue. * removed some more en-us * more backupRestoreHelloWorld and backupSelectiveRestore instances * Fixed https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485179185 * some fixes Re-arranged some sections to make more sense, which hopefully addresses: https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485210714 Fixed the core-lro link. Fixes https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485374247 Replaced `Admin` with `Administration`, to stay consistent. Lowered `Long Running Operations`, thus addressing: https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485376464 * Update sdk/keyvault/keyvault-admin/README.md Co-authored-by: Ramya Rao * more changes - Lowercased some LRO references. - One fixes: https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485377738 - Changed the example intro paragraph, which hopefully addresses: - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485380890 - Cleaned up the environment variables with this too: https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485386025 * Update sdk/keyvault/keyvault-admin/CHANGELOG.md Co-authored-by: Ramya Rao * Addressing https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485213901 * Addressing https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485976469 and merging some lines * Addressing https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485968140 * Addressing https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485972878 * Addressing two feedbacks - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485974431 - https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485974763 * Addressing https://github.com/Azure/azure-sdk-for-js/pull/11075#discussion_r485994803 * Clarification about the CLIENT_OBJECT_ID * fixing samples link for CI. Later well make them absolute * removing links to the source since they are broken at the moment Co-authored-by: Ramya Rao --- sdk/keyvault/keyvault-admin/CHANGELOG.md | 7 +- sdk/keyvault/keyvault-admin/README.md | 209 ++++++++++++++++-- sdk/keyvault/keyvault-admin/package.json | 6 +- sdk/keyvault/keyvault-admin/sample.env | 27 +++ .../samples/javascript/README.md | 72 ++++++ .../javascript/accessControlHelloWorld.js | 51 +++++ .../javascript/backupRestoreHelloWorld.js | 42 ++++ .../javascript/backupSelectiveRestore.js | 53 +++++ .../samples/javascript/sample.env | 28 +++ .../samples/typescript/README.md | 84 +++++++ .../samples/typescript/package.json | 45 ++++ .../samples/typescript/sample.env | 28 +++ .../typescript/src/accessControlHelloWorld.ts | 51 +++++ .../typescript/src/backupRestoreHelloWorld.ts | 43 ++++ .../typescript/src/backupSelectiveRestore.ts | 54 +++++ .../samples/typescript/tsconfig.json | 16 ++ sdk/keyvault/keyvault-admin/test/README.md | 42 ++++ .../samples/javascript/README.md | 2 +- .../samples/typescript/README.md | 2 +- 19 files changed, 836 insertions(+), 26 deletions(-) create mode 100644 sdk/keyvault/keyvault-admin/sample.env create mode 100644 sdk/keyvault/keyvault-admin/samples/javascript/README.md create mode 100644 sdk/keyvault/keyvault-admin/samples/javascript/accessControlHelloWorld.js create mode 100644 sdk/keyvault/keyvault-admin/samples/javascript/backupRestoreHelloWorld.js create mode 100644 sdk/keyvault/keyvault-admin/samples/javascript/backupSelectiveRestore.js create mode 100644 sdk/keyvault/keyvault-admin/samples/javascript/sample.env create mode 100644 sdk/keyvault/keyvault-admin/samples/typescript/README.md create mode 100644 sdk/keyvault/keyvault-admin/samples/typescript/package.json create mode 100644 sdk/keyvault/keyvault-admin/samples/typescript/sample.env create mode 100644 sdk/keyvault/keyvault-admin/samples/typescript/src/accessControlHelloWorld.ts create mode 100644 sdk/keyvault/keyvault-admin/samples/typescript/src/backupRestoreHelloWorld.ts create mode 100644 sdk/keyvault/keyvault-admin/samples/typescript/src/backupSelectiveRestore.ts create mode 100644 sdk/keyvault/keyvault-admin/samples/typescript/tsconfig.json create mode 100644 sdk/keyvault/keyvault-admin/test/README.md diff --git a/sdk/keyvault/keyvault-admin/CHANGELOG.md b/sdk/keyvault/keyvault-admin/CHANGELOG.md index 084c007ea8a5..90dba13a1616 100644 --- a/sdk/keyvault/keyvault-admin/CHANGELOG.md +++ b/sdk/keyvault/keyvault-admin/CHANGELOG.md @@ -1,5 +1,8 @@ # Release History -## 1.0.0-preview.1 (Unreleased) +## 4.0.0-beta.1 (Unreleased) -- Produced the generated code for the administrative Key Vault tasks. It includes the backup and restore operations for whole Key Vault instances, and the role-based access control (RBAC) operations. +The @azure/keyvault-admin package provides two clients, `KeyVaultAccessControlClient` and `KeyVaultBackupClient`. + +- The `KeyVaultAccessControlClient` allows working with role-based access control (RBAC) operations, meaning assigning, deleting and retrieving role assignments, and retrieving role definitions. +- The `KeyVaultBackupClient` allows generating full backups and restores of Key Vault instances, and selective restores of keys. diff --git a/sdk/keyvault/keyvault-admin/README.md b/sdk/keyvault/keyvault-admin/README.md index f38b4cf11dfc..b34994538df5 100644 --- a/sdk/keyvault/keyvault-admin/README.md +++ b/sdk/keyvault/keyvault-admin/README.md @@ -1,30 +1,83 @@ -# Azure Key Vault Admin client library for JavaScript +# Azure Key Vault Administration client library for JavaScript Azure Key Vault is a service that allows you to encrypt authentication keys, storage account keys, data encryption keys, .pfx files, and passwords by using secured keys. -If you would like to know more about Azure Key Vault, you may want to review: [What is Azure Key Vault?](https://docs.microsoft.com/en-us/azure/key-vault/key-vault-overview) +If you would like to know more about Azure Key Vault, you may want to review: [What is Azure Key Vault?][docs-overview] The package `@azure/keyvault-admin` provides support for the administrative Key Vault tasks. It includes the backup and restore operations for whole Key Vault instances, and the role-based access control (RBAC) operations. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin) | [Package (npm)](https://www.npmjs.com/package/@azure/keyvault-admin) | [API Reference Documentation](https://docs.microsoft.com/javascript/api/@azure/keyvault-admin) | [Product documentation](https://azure.microsoft.com/en-us/services/key-vault/) | [Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/samples) +[Source code][package-gh] | [Package (npm)][package-npm] | [API Reference Documentation][docs] | [Product documentation][docs-service] | [Samples][samples] ## Getting started -**Prerequisites**: You must have an [Azure subscription](https://azure.microsoft.com/free/) and a -[Key Vault resource](https://docs.microsoft.com/en-us/azure/key-vault/quick-create-portal) to use this package. - -If you are using this package in a Node.js application, then use Node.js 8.x or higher. - ### Install the package -Install the Azure Key Vault Admin client library using npm: - -`npm install @azure/keyvault-admin` +Install the Azure Key Vault administration client library for JavaScript and TypeScript with [NPM][NPM]: -### Install the identity library - -Key Vault clients authenticate using the Azure Identity Library. Install it as well using npm +```PowerShell +npm install @azure/keyvault-admin +``` -`npm install @azure/identity` +### Prerequisites + +To work with the Azure Key Vault Administration client, the following is necessary: + +* An [Azure subscription][azure-sub]. +* An existing Azure Key Vault. If you need to create an Azure Key Vault, you can use the [Azure CLI][azure-cli]. +* Use [Node.js](https://nodejs.org/) 8.x or higher. + +#### Getting Azure credentials + +Use the [Azure CLI][azure-cli] snippet below to create/get client secret credentials. + + * Create a service principal and configure its access to Azure resources: + ```PowerShell + az ad sp create-for-rbac -n --skip-assignment + ``` + Output: + ```json + { + "appId": "generated-app-ID", + "displayName": "some-app-name", + "name": "http://some-app-name", + "password": "random-password", + "tenant": "tenant-ID" + } + ``` +* Take note of the service principal objectId + ```PowerShell + az ad sp show --id --query objectId + ``` + Output: + ``` + "" + ``` +* Use the returned credentials above to set **AZURE_CLIENT_ID** (appId), **AZURE_CLIENT_SECRET** (password), and **AZURE_TENANT_ID** (tenant) environment variables. + +#### Get or create an Azure Key Vault with the Azure CLI + +* Create the Key Vault and grant the above mentioned application authorization to perform administrative operations on the Azure Key Vault (replace `` and `` with your own, unique names and `` with the value from above): + ``` + az keyvault create --hsm-name --resource-group --administrators --location + ``` + +* Use the above mentioned Azure Key Vault name to retrieve details of your Vault which also contains your Azure Key Vault URL: + ```PowerShell + az keyvault show --hsm-name + ``` + +#### Get or create an Azure Storage Account with the Azure CLI + +A storage account is necessary to generate the backup of a Key Vault. + +To generate Key Vault backups, you will need to point the `KeyVaultBackupClient` to an existing Storage account. + +To create a new Storage Account, you can use the [Azure Portal][storage-account-create-portal], +[Azure PowerShell][storage-account-create-ps], or the [Azure CLI][storage-account-create-cli]. +Here's an example using the Azure CLI: + +```Powershell +az storage account create --name MyStorageAccount --resource-group MyResourceGroup --location westus --sku Standard_LRS +``` ### Configure TypeScript @@ -34,16 +87,101 @@ TypeScript users need to have Node type definitions installed: npm install @types/node ``` -You also need to enable `compilerOptions.allowSyntheticDefaultImports` in your tsconfig.json. Note that if you have enabled `compilerOptions.esModuleInterop`, `allowSyntheticDefaultImports` is enabled by default. See [TypeScript's compiler options handbook](https://www.typescriptlang.org/docs/handbook/compiler-options.html) for more information. +You also need to enable `compilerOptions.allowSyntheticDefaultImports` in your tsconfig.json. Note that if you have enabled `compilerOptions.esModuleInterop`, `allowSyntheticDefaultImports` is enabled by default. See [TypeScript's compiler options handbook][compiler-options] for more information. + +### Authenticate the client + +In order to control permissions to the Key Vault service, or to generate and restore backups of a specific Key Vault, you'll need to create either an instance of the `KeyVaultAccessControlClient` class, or an instance of the `KeyVaultBackupClient` class, respectively. + +In both cases, you'll need a **vault URL**, which you may see as "DNS Name" in the portal, and a credential object from the [@azure/identity][identity-npm] package which is used to authenticate with Azure Active Directory. + +In the below example, we are using a **client secret credentials (client id, client secret, tenant id)**, but you can find more ways to authenticate with [Azure Identity][azure-identity]. To use the [DefaultAzureCredential][DAC] provider shown below, or other credential providers provided with the Azure SDK, you should install the [@azure/identity][identity-npm] package: + +```PowerShell +npm install @azure/identity +``` + +#### Create KeyVaultAccessControlClient + +Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and **AZURE_TENANT_ID** environment variables and replaced **your-vault-url** with the above returned URI, you can create the `KeyVaultAccessControlClient`: + +```ts +import { DefaultAzureCredential } from "@azure/identity"; +import { KeyVaultBackupClient } from "@azure/keyvault-admin"; + +const credentials = new DefaultAzureCredential(); + +const vaultUrl = `https://.vault.azure.net`; +const client = new KeyVaultAccessControlClient(vaultUrl, credentials); +``` + +#### Create KeyVaultBackupClient + +Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and **AZURE_TENANT_ID** environment variables and replaced **your-vault-url** with the above returned URI, you can create the `KeyVaultBackupClient`: + +```ts +import { DefaultAzureCredential } from "@azure/identity"; +import { KeyVaultBackupClient } from "@azure/keyvault-admin"; -### Configuring your Key Vault +const credentials = new DefaultAzureCredential(); + +const vaultUrl = `https://.vault.azure.net`; +const client = new KeyVaultBackupClient(vaultUrl, credentials); +``` ## Key concepts -## Authenticating with Azure Active Directory +### KeyVaultRoleDefinition + +A Role Definition is a collection of permissions. A role definition defines the operations that can be performed, such as read, write, and delete. It can also define the operations that are excluded from allowed operations. + +Role definitions can be listed and specified as part of a Role Assignment. + +### KeyVaultRoleAssignment. + +A Role Assignment is the association of a Role Definition to a service principal. They can be created, listed, fetched individually, and deleted. + +### KeyVaultAccessControlClient + +A `KeyVaultAccessControlClient` provides both synchronous and asynchronous operations allowing for management of Role Definitions (instances of `KeyVaultRoleDefinition`) and Role Assignments (instances of `KeyVaultRoleAssignment`). + +### KeyVaultBackupClient + +A `KeyVaultBackupClient` provides both synchronous and asynchronous operations for performing full key backups, full key restores, and selective key restores. + +### Long running operations + +The operations done by the `KeyVaultBackupClient` may take as much time as needed by the Azure resources, requiring a client layer to keep track, serialize and resume the operations through the lifecycle of the programs that wait for them to finish. This is done via a common abstraction through the package [@azure/core-lro][core-lro]. + +The `KeyVaultBackupClient` offers three methods that execute long running operations: + +- `beginBackup`, starts generating a backup of an Azure Key Vault on the specified Storage Blob account. +- `beginRestore`, starts restoring all key materials using the SAS token pointing to a previously stored Azure Blob storage backup folder. +- `beginSelectiveRestore`, starts restoring all key versions of a given key using user supplied SAS token pointing to a previously stored Azure Blob storage backup folder. + +The methods that begin long running operations return a poller that allows you to wait indefinitely until the operation is complete. More information is available on the examples below. ## Examples +We have samples both in JavaScript and TypeScript that show the access control and backup/restore features in this package. Please follow the corresponding readmes for detailed steps to run the samples. + +- [Readme for JavaScript samples](./samples/javascript/README.md) +- [Readme for TypeScript samples](./samples/typescript/README.md) + +Direct links to the specific JavaScript samples follow: + +- Access control (RBAC): + - [Listing All Role Definitions](./samples/javascript/accessControlHelloWorld.js) + - [Listing All Role Assignments](./samples/javascript/accessControlHelloWorld.js) + - [Creating a Role Assignment](./samples/javascript/accessControlHelloWorld.js) + - [Getting a Role Assignment](./samples/javascript/accessControlHelloWorld.js) + - [Deleting a Role Assignment](./samples/javascript/accessControlHelloWorld.js) +- Backup and restore: + - [Performing a full key backup](./samples/javascript/backupRestoreHelloWorld.js) + - [Performing a full key restore](./samples/javascript/backupRestoreHelloWorld.js) + - [Performing a selective key backup](./samples/javascript/backupSelectiveRestore.js) + - [Performing a selective key restore](./samples/javascript/backupSelectiveRestore.js) + ## Troubleshooting Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: @@ -58,12 +196,41 @@ setLogLevel("info"); You can find more code samples through the following links: -- [KeyVault Admin Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/samples/javascript) -- [KeyVault Admin Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/samples/typescript) -- [KeyVault Admin Test Cases](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/test/) +- [KeyVault Administration Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/samples/javascript) +- [KeyVault Administration Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/samples/typescript) +- [KeyVault Administration Test Cases](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/test/) ## Contributing If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code. ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fkeyvault%2Fkeyvault-admin%2FREADME.png) + + +[NPM]: https://www.npmjs.com/ +[package-gh]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin +[package-npm]: https://www.npmjs.com/package/@azure/keyvault-admin +[identity-npm]: https://www.npmjs.com/package/@azure/identity +[docs]: https://docs.microsoft.com/javascript/api/@azure/keyvault-admin +[docs-service]: https://azure.microsoft.com/services/key-vault/ +[docs-overview]: https://docs.microsoft.com/azure/key-vault/key-vault-overview +[samples]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/samples +[azure-sub]: https://azure.microsoft.com/free/ +[azure-cli]: https://docs.microsoft.com/cli/azure +[azure-identity]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity +[api-rest]: https://docs.microsoft.com/rest/api/keyvault/ +[compiler-options]: https://www.typescriptlang.org/docs/handbook/compiler-options.html +[dotenv]: https://www.npmjs.com/package/dotenv] +[DAC]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/identity/Azure.Identity/README.md +[storage-account-create-ps]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-powershell +[storage-account-create-cli]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli +[storage-account-create-portal]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[core-lro]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/core-lro +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ +[backup_client]: ./src/KeyVaultBackupClient.cs +[keyvault_docs]: https://docs.microsoft.com/azure/key-vault/ +[JWK]: https://tools.ietf.org/html/rfc7517 +[logging]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/samples/Diagnostics.ts.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Microsoft.Azure.KeyVault/CONTRIBUTING.md + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ftables%2FAzure.Data.Tables%2FREADME.png) diff --git a/sdk/keyvault/keyvault-admin/package.json b/sdk/keyvault/keyvault-admin/package.json index 4787e2d3111d..21abd3091396 100644 --- a/sdk/keyvault/keyvault-admin/package.json +++ b/sdk/keyvault/keyvault-admin/package.json @@ -14,7 +14,11 @@ "typescript", "browser", "isomorphic", - "keyvault" + "keyvault", + "backup", + "restore", + "access", + "role" ], "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" diff --git a/sdk/keyvault/keyvault-admin/sample.env b/sdk/keyvault/keyvault-admin/sample.env new file mode 100644 index 000000000000..8465987e4984 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/sample.env @@ -0,0 +1,27 @@ +# The name of the key vault to use in the samples. +# Create a Key Vault in the Azure Portal and enter its URI (e.g. https://mytest.vault.azure.net/) here. +KEYVAULT_URI= + +# The name of the Key Vault. +KEYVAULT_NAME= + +# URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated. +BLOB_STORAGE_URI= + +# URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated. +BLOB_STORAGE_SAS_TOKEN= + +# Object ID of the application, tenant or principal to whom the role will be assigned to. +CLIENT_OBJECT_ID= + +# Used to authenticate using Azure AD as a service principal for role-based authentication. +# +# See the documentation for `EnvironmentCredential` at the following link: +# https://docs.microsoft.com/javascript/api/@azure/identity/environmentcredential +AZURE_TENANT_ID= +AZURE_CLIENT_ID= +AZURE_CLIENT_SECRET= + +# Our tests assume that TEST_MODE is "playback" by default. You can +# change it to "record" to generate new recordings, or "live" to bypass the recorder entirely. +# TEST_MODE=playback \ No newline at end of file diff --git a/sdk/keyvault/keyvault-admin/samples/javascript/README.md b/sdk/keyvault/keyvault-admin/samples/javascript/README.md new file mode 100644 index 000000000000..b2858cc93ec4 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/javascript/README.md @@ -0,0 +1,72 @@ +--- +page_type: sample +languages: + - javascript +products: + - azure + - azure-key-vault +urlFragment: keyvault-admin-javascript +--- + +# Azure Key Vault Administration client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for Azure Key Vault Keys in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------- | +| [accessControlHelloWorld.js][accessControlHelloWorld] (RBAC) | Lists all Role Definitions and Role Assignments, Creates a Role Assignment, then gets it and later deletes it. | +| [backupRestoreHelloWorld.js][BackupRestoreHelloWorld] | Performs a full key backup, then a full key restore. | +| [backupSelectiveRestore.js][BackupSelectiveRestore] | Performs a selective key backup, then a selective key restore. | + +## Prerequisites + +The samples are compatible with Node.js >= 8.0.0. + +You need [an Azure subscription][freesub] and [an Azure Key Vault][azkeyvault] to run these sample programs. To quickly create the needed Key Vault resources in Azure and to receive a connection string for them, you can deploy our sample template by clicking: + +[![](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-sdk-for-js%2Fmaster%2Fsdk%2Fkeyvault%2Ftests-resources.json) + +If creating the Key Vault manually using the Azure Portal, be aware that the samples require that the soft-delete feature be enabled. Our template above will enable this feature automatically, but it is possible to enable it manually using the Azure CLI. See [this page][kvsoftdelete] for more information. + +Samples retrieve credentials to access the Key Vault from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node backupRestoreHelloWorld.js +``` + +Alternatively, run a single sample with the correct environment variables set (step 2 is not required if you do this), for example (cross-platform): + +```bash +npx cross-env KEYVAULT_NAME="" AZURE_TENANT_ID="" AZURE_CLIENT_ID="" AZURE_CLIENT_SECRET="" BLOB_STORAGE_URI="" BLOB_STORAGE_SAS_TOKEN="" CLIENT_OBJECT_ID="" node backupRestoreHelloWorld.js +``` + +These samples add and remove roles to and from the application, tenant or principal specified by the `CLIENT_OBJECT_ID` environment variable. **Do not use the same Object Id of the application, tenant or principal you're using to authenticate the client.** + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accessControlHelloWorld]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/javascript/accessControlHelloWorld.js +[BackupRestoreHelloWorld]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/javascript/backupRestoreHelloWorld.js +[BackupSelectiveRestore]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/javascript/backupSelectiveRestore.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/keyvault-admin +[azkeyvault]: https://docs.microsoft.com/azure/key-vault/quick-create-portal +[kvsoftdelete]: https://docs.microsoft.com/azure/key-vault/key-vault-soft-delete-cli +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/README.md diff --git a/sdk/keyvault/keyvault-admin/samples/javascript/accessControlHelloWorld.js b/sdk/keyvault/keyvault-admin/samples/javascript/accessControlHelloWorld.js new file mode 100644 index 000000000000..e97ca52ec484 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/javascript/accessControlHelloWorld.js @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +const { KeyVaultAccessControlClient } = require("@azure/keyvault-admin"); +const { DefaultAzureCredential } = require("@azure/identity"); +const uuid = require("uuid"); +const uuidv4 = uuid.v4; + +// Load the .env file if it exists +require("dotenv").config(); + +async function main() { + // DefaultAzureCredential expects the following three environment variables: + // - AZURE_TENANT_ID: The tenant ID in Azure Active Directory + // - AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant + // - AZURE_CLIENT_SECRET: The client secret for the registered application + // - BLOB_STORAGE_URI: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - BLOB_STORAGE_SAS_TOKEN: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - CLIENT_OBJECT_ID: Object ID of the application, tenant or principal to whom the role will be assigned to + const credential = new DefaultAzureCredential(); + const url = process.env["KEYVAULT_URI"] || ""; + const client = new KeyVaultAccessControlClient(url, credential); + + for await (const roleAssignment of client.listRoleAssignments("/")) { + console.log(roleAssignment); + } + + const globalScope = "/"; + const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; + + const roleAssignmentName = uuidv4(); + let assignment = await client.createRoleAssignment( + globalScope, + roleAssignmentName, + roleDefinition.id, + process.env["CLIENT_OBJECT_ID"] + ); + console.log(assignment); + + assignment = await client.getRoleAssignment(globalScope, roleAssignmentName); + console.log(assignment); + + assignment = await client.deleteRoleAssignment(globalScope, roleAssignmentName); + console.log(assignment); +} + +main().catch((err) => { + console.log("error code: ", err.code); + console.log("error message: ", err.message); + console.log("error stack: ", err.stack); +}); diff --git a/sdk/keyvault/keyvault-admin/samples/javascript/backupRestoreHelloWorld.js b/sdk/keyvault/keyvault-admin/samples/javascript/backupRestoreHelloWorld.js new file mode 100644 index 000000000000..ee5bc160d4ca --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/javascript/backupRestoreHelloWorld.js @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +const { KeyVaultBackupClient } = require("@azure/keyvault-admin"); +const { DefaultAzureCredential } = require("@azure/identity"); + +// Load the .env file if it exists +require("dotenv").config(); + +async function main() { + // DefaultAzureCredential expects the following three environment variables: + // - AZURE_TENANT_ID: The tenant ID in Azure Active Directory + // - AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant + // - AZURE_CLIENT_SECRET: The client secret for the registered application + // - BLOB_STORAGE_URI: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - BLOB_STORAGE_SAS_TOKEN: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - CLIENT_OBJECT_ID: Object ID of the application, tenant or principal to whom the role will be assigned to + const credential = new DefaultAzureCredential(); + const url = process.env["KEYVAULT_URI"] || ""; + const client = new KeyVaultBackupClient(url, credential); + + const blobStorageUri = process.env["BLOB_STORAGE_URI"]; + const sasToken = process.env["BLOB_STORAGE_SAS_TOKEN"]; + const backupPoller = await client.beginBackup(blobStorageUri, sasToken); + const backupURI = await backupPoller.pollUntilDone(); + + // The folder name should be at the end of the blobStorageUri, as in: https:/// + const folderName = "backup"; + + const restorePoller = await client.beginRestore( + blobStorageUri, + sasToken, + folderName + ); + await restorePoller.pollUntilDone(); +} + +main().catch((err) => { + console.log("error code: ", err.code); + console.log("error message: ", err.message); + console.log("error stack: ", err.stack); +}); diff --git a/sdk/keyvault/keyvault-admin/samples/javascript/backupSelectiveRestore.js b/sdk/keyvault/keyvault-admin/samples/javascript/backupSelectiveRestore.js new file mode 100644 index 000000000000..e694c93144fb --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/javascript/backupSelectiveRestore.js @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +const { KeyVaultBackupClient } = require("@azure/keyvault-admin"); +const { KeyClient } = require("@azure/keyvault-keys"); +const { DefaultAzureCredential } = require("@azure/identity"); + +// Load the .env file if it exists +require("dotenv").config(); + +async function main() { + // DefaultAzureCredential expects the following three environment variables: + // - AZURE_TENANT_ID: The tenant ID in Azure Active Directory + // - AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant + // - AZURE_CLIENT_SECRET: The client secret for the registered application + // - BLOB_STORAGE_URI: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - BLOB_STORAGE_SAS_TOKEN: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - CLIENT_OBJECT_ID: Object ID of the application, tenant or principal to whom the role will be assigned to + const credential = new DefaultAzureCredential(); + const url = process.env["KEYVAULT_URI"] || ""; + const client = new KeyVaultBackupClient(url, credential); + + const keyClient = new KeyClient(url, credential); + const keyName = "key-name"; + const key = await keyClient.createRsaKey(keyName); + + const blobStorageUri = process.env["BLOB_STORAGE_URI"]; + const sasToken = process.env["BLOB_STORAGE_SAS_TOKEN"]; + const backupPoller = await client.beginBackup(blobStorageUri, sasToken); + const backupURI = await backupPoller.pollUntilDone(); + + // The folder name should be at the end of the blobStorageUri, as in: https:/// + const folderName = "backup"; + + const selectiveRestorePoller = await client.beginSelectiveRestore( + blobStorageUri, + sasToken, + folderName, + key.name + ); + await selectiveRestorePoller.pollUntilDone(); + + // Deleting and purging the key, just in case we want to create the same key again. + const deleteKeyPoller = await keyClient.beginDeleteKey(keyName); + await deleteKeyPoller.pollUntilDone(); + await keyClient.purgeDeletedKey(keyName); +} + +main().catch((err) => { + console.log("error code: ", err.code); + console.log("error message: ", err.message); + console.log("error stack: ", err.stack); +}); diff --git a/sdk/keyvault/keyvault-admin/samples/javascript/sample.env b/sdk/keyvault/keyvault-admin/samples/javascript/sample.env new file mode 100644 index 000000000000..369ed47f9fb2 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/javascript/sample.env @@ -0,0 +1,28 @@ +# The name of the key vault to use in the samples. +# Create a Key Vault in the Azure Portal and enter its URI (e.g. https://mytest.vault.azure.net/) here. +KEYVAULT_URI= + +# The name of the Key Vault. +KEYVAULT_NAME= + +# URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated. +BLOB_STORAGE_URI= + +# URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated. +BLOB_STORAGE_SAS_TOKEN= + +# Object ID of the application, tenant or principal to whom the role will be assigned to. +# Do not use the same Object Id of the application, tenant or principal you're using to authenticate the client. +CLIENT_OBJECT_ID= + +# Used to authenticate using Azure AD as a service principal for role-based authentication. +# +# See the documentation for `EnvironmentCredential` at the following link: +# https://docs.microsoft.com/javascript/api/@azure/identity/environmentcredential +AZURE_TENANT_ID= +AZURE_CLIENT_ID= +AZURE_CLIENT_SECRET= + +# Our tests assume that TEST_MODE is "playback" by default. You can +# change it to "record" to generate new recordings, or "live" to bypass the recorder entirely. +# TEST_MODE=playback \ No newline at end of file diff --git a/sdk/keyvault/keyvault-admin/samples/typescript/README.md b/sdk/keyvault/keyvault-admin/samples/typescript/README.md new file mode 100644 index 000000000000..ffffe0b446ec --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/typescript/README.md @@ -0,0 +1,84 @@ +--- +page_type: sample +languages: + - typescript +products: + - azure + - azure-key-vault +urlFragment: keyvault-admin-typescript +--- + +# Azure Key Vault Administration client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for Azure Key Vault Keys in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------- | +| [accessControlHelloWorld.ts][accessControlHelloWorld] (RBAC) | Lists all Role Definitions and Role Assignments, Creates a Role Assignment, then gets it and later deletes it. | +| [backupRestoreHelloWorld.ts][BackupRestoreHelloWorld] | Performs a full key backup, then a full key restore. | +| [backupSelectiveRestore.ts][BackupSelectiveRestore] | Performs a selective key backup, then a selective key restore. | + +## Prerequisites + +The samples are compatible with Node.ts >= 8.0.0. + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] and [an Azure Key Vault][azkeyvault] to run these sample programs. To quickly create the needed Key Vault resources in Azure and to receive a connection string for them, you can deploy our sample template by clicking: + +[![](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-sdk-for-js%2Fmaster%2Fsdk%2Fkeyvault%2Ftests-resourcestjson) + +If creating the Key Vault manually using the Azure Portal, be aware that the samples require that the soft-delete feature be enabled. Our template above will enable this feature automatically, but it is possible to enable it manually using the Azure CLI. See [this page][kvsoftdelete] for more information. + +Samples retrieve credentials to access the Key Vault from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/backupRestoreHelloWorld.ts +``` + +Alternatively, run a single sample with the correct environment variables set (step 2 is not required if you do this), for example (cross-platform): + +```bash +npx cross-env KEYVAULT_NAME="" AZURE_TENANT_ID="" AZURE_CLIENT_ID="" AZURE_CLIENT_SECRET="" BLOB_STORAGE_URI="" BLOB_STORAGE_SAS_TOKEN="" CLIENT_OBJECT_ID="" node dist/backupRestoreHelloWorld.ts +``` + +These samples add and remove roles to and from the application, tenant or principal specified by the `CLIENT_OBJECT_ID` environment variable. **Do not use the same Object Id of the application, tenant or principal you're using to authenticate the client.** + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accessControlHelloWorld]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/typescript/src/accessControlHelloWorld.ts +[BackupRestoreHelloWorld]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/typescript/src/backupRestoreHelloWorld.ts +[BackupSelectiveRestore]: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-admin/samples/typescript/src/backupSelectiveRestore.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/keyvault-admin +[azkeyvault]: https://docs.microsoft.com/azure/key-vault/quick-create-portal +[kvsoftdelete]: https://docs.microsoft.com/azure/key-vault/key-vault-soft-delete-cli +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-admin/README.md diff --git a/sdk/keyvault/keyvault-admin/samples/typescript/package.json b/sdk/keyvault/keyvault-admin/samples/typescript/package.json new file mode 100644 index 000000000000..e8563aa95365 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/typescript/package.json @@ -0,0 +1,45 @@ +{ + "name": "azure-keyvault-admin-samples-ts", + "private": true, + "version": "0.1.0", + "description": "Azure Key Vault Admin client library samples for TypeScript", + "engine": { + "node": ">=8.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git" + }, + "keywords": [ + "Azure", + "Key Vault", + "Admin", + "Node.js", + "TypeScript" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js#readme", + "sideEffects": false, + "dependencies": { + "@azure/identity": "latest", + "@azure/keyvault-admin": "latest", + "@azure/keyvault-keys": "latest", + "dotenv": "^8.2.0", + "uuid": "^8.1.0" + }, + "devDependencies": { + "@types/node": "^8.0.0", + "@types/uuid": "^8.0.0", + "rimraf": "^3.0.0", + "typescript": "~3.6.4" + } + } + \ No newline at end of file diff --git a/sdk/keyvault/keyvault-admin/samples/typescript/sample.env b/sdk/keyvault/keyvault-admin/samples/typescript/sample.env new file mode 100644 index 000000000000..369ed47f9fb2 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/typescript/sample.env @@ -0,0 +1,28 @@ +# The name of the key vault to use in the samples. +# Create a Key Vault in the Azure Portal and enter its URI (e.g. https://mytest.vault.azure.net/) here. +KEYVAULT_URI= + +# The name of the Key Vault. +KEYVAULT_NAME= + +# URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated. +BLOB_STORAGE_URI= + +# URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated. +BLOB_STORAGE_SAS_TOKEN= + +# Object ID of the application, tenant or principal to whom the role will be assigned to. +# Do not use the same Object Id of the application, tenant or principal you're using to authenticate the client. +CLIENT_OBJECT_ID= + +# Used to authenticate using Azure AD as a service principal for role-based authentication. +# +# See the documentation for `EnvironmentCredential` at the following link: +# https://docs.microsoft.com/javascript/api/@azure/identity/environmentcredential +AZURE_TENANT_ID= +AZURE_CLIENT_ID= +AZURE_CLIENT_SECRET= + +# Our tests assume that TEST_MODE is "playback" by default. You can +# change it to "record" to generate new recordings, or "live" to bypass the recorder entirely. +# TEST_MODE=playback \ No newline at end of file diff --git a/sdk/keyvault/keyvault-admin/samples/typescript/src/accessControlHelloWorld.ts b/sdk/keyvault/keyvault-admin/samples/typescript/src/accessControlHelloWorld.ts new file mode 100644 index 000000000000..32b680d3a9bd --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/typescript/src/accessControlHelloWorld.ts @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { KeyVaultAccessControlClient } from "@azure/keyvault-admin"; +import { DefaultAzureCredential } from "@azure/identity"; +import { v4 as uuidv4 } from "uuid"; + +// Load the .env file if it exists +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main(): Promise { + // DefaultAzureCredential expects the following three environment variables: + // - AZURE_TENANT_ID: The tenant ID in Azure Active Directory + // - AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant + // - AZURE_CLIENT_SECRET: The client secret for the registered application + // - BLOB_STORAGE_URI: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - BLOB_STORAGE_SAS_TOKEN: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - CLIENT_OBJECT_ID: Object ID of the application, tenant or principal to whom the role will be assigned to + const credential = new DefaultAzureCredential(); + const url = process.env["KEYVAULT_URI"] || ""; + const client = new KeyVaultAccessControlClient(url, credential); + + for await (const roleAssignment of client.listRoleAssignments("/")) { + console.log(roleAssignment); + } + + const globalScope = "/"; + const roleDefinition = (await client.listRoleDefinitions(globalScope).next()).value; + + const roleAssignmentName = uuidv4(); + let assignment = await client.createRoleAssignment( + globalScope, + roleAssignmentName, + roleDefinition.id, + process.env["CLIENT_OBJECT_ID"] + ); + console.log(assignment); + + assignment = await client.getRoleAssignment(globalScope, roleAssignmentName); + console.log(assignment); + + assignment = await client.deleteRoleAssignment(globalScope, roleAssignmentName); + console.log(assignment); +} + +main().catch((err) => { + console.log("error code: ", err.code); + console.log("error message: ", err.message); + console.log("error stack: ", err.stack); +}); diff --git a/sdk/keyvault/keyvault-admin/samples/typescript/src/backupRestoreHelloWorld.ts b/sdk/keyvault/keyvault-admin/samples/typescript/src/backupRestoreHelloWorld.ts new file mode 100644 index 000000000000..6768cc8fe69f --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/typescript/src/backupRestoreHelloWorld.ts @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { KeyVaultBackupClient } from "@azure/keyvault-admin"; +import { DefaultAzureCredential } from "@azure/identity"; + +// Load the .env file if it exists +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main(): Promise { + // DefaultAzureCredential expects the following three environment variables: + // - AZURE_TENANT_ID: The tenant ID in Azure Active Directory + // - AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant + // - AZURE_CLIENT_SECRET: The client secret for the registered application + // - BLOB_STORAGE_URI: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - BLOB_STORAGE_SAS_TOKEN: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - CLIENT_OBJECT_ID: Object ID of the application, tenant or principal to whom the role will be assigned to + const credential = new DefaultAzureCredential(); + const url = process.env["KEYVAULT_URI"] || ""; + const client = new KeyVaultBackupClient(url, credential); + + const blobStorageUri = process.env["BLOB_STORAGE_URI"]; + const sasToken = process.env["BLOB_STORAGE_SAS_TOKEN"]; + const backupPoller = await client.beginBackup(blobStorageUri, sasToken); + const backupURI = await backupPoller.pollUntilDone(); + + // The folder name should be at the end of the blobStorageUri, as in: https:/// + const folderName = "backup"; + + const restorePoller = await client.beginRestore( + blobStorageUri, + sasToken, + folderName + ); + await restorePoller.pollUntilDone(); +} + +main().catch((err) => { + console.log("error code: ", err.code); + console.log("error message: ", err.message); + console.log("error stack: ", err.stack); +}); diff --git a/sdk/keyvault/keyvault-admin/samples/typescript/src/backupSelectiveRestore.ts b/sdk/keyvault/keyvault-admin/samples/typescript/src/backupSelectiveRestore.ts new file mode 100644 index 000000000000..003b3a1c40e9 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/typescript/src/backupSelectiveRestore.ts @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { KeyVaultBackupClient } from "@azure/keyvault-admin"; +import { KeyClient } from "@azure/keyvault-keys"; +import { DefaultAzureCredential } from "@azure/identity"; + +// Load the .env file if it exists +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main(): Promise { + // DefaultAzureCredential expects the following three environment variables: + // - AZURE_TENANT_ID: The tenant ID in Azure Active Directory + // - AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant + // - AZURE_CLIENT_SECRET: The client secret for the registered application + // - BLOB_STORAGE_URI: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - BLOB_STORAGE_SAS_TOKEN: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated + // - CLIENT_OBJECT_ID: Object ID of the application, tenant or principal to whom the role will be assigned to + const credential = new DefaultAzureCredential(); + const url = process.env["KEYVAULT_URI"] || ""; + const client = new KeyVaultBackupClient(url, credential); + + const keyClient = new KeyClient(url, credential); + const keyName = "key-name"; + const key = await keyClient.createRsaKey(keyName); + + const blobStorageUri = process.env["BLOB_STORAGE_URI"]; + const sasToken = process.env["BLOB_STORAGE_SAS_TOKEN"]; + const backupPoller = await client.beginBackup(blobStorageUri, sasToken); + const backupURI = await backupPoller.pollUntilDone(); + + // The folder name should be at the end of the blobStorageUri, as in: https:/// + const folderName = "backup"; + + const selectiveRestorePoller = await client.beginSelectiveRestore( + blobStorageUri, + sasToken, + folderName, + key.name + ); + await selectiveRestorePoller.pollUntilDone(); + + // Deleting and purging the key, just in case we want to create the same key again. + const deleteKeyPoller = await keyClient.beginDeleteKey(keyName); + await deleteKeyPoller.pollUntilDone(); + await keyClient.purgeDeletedKey(keyName); +} + +main().catch((err) => { + console.log("error code: ", err.code); + console.log("error message: ", err.message); + console.log("error stack: ", err.stack); +}); diff --git a/sdk/keyvault/keyvault-admin/samples/typescript/tsconfig.json b/sdk/keyvault/keyvault-admin/samples/typescript/tsconfig.json new file mode 100644 index 000000000000..bcc9779f34aa --- /dev/null +++ b/sdk/keyvault/keyvault-admin/samples/typescript/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + + "lib": ["dom", "dom.iterable", "esnext.asynciterable"], + + "allowSyntheticDefaultImports": true, + + "outDir": "dist", + "rootDir": "src" + }, + "include": ["src/**.ts"], + "exclude": ["node_modules"] + } + \ No newline at end of file diff --git a/sdk/keyvault/keyvault-admin/test/README.md b/sdk/keyvault/keyvault-admin/test/README.md new file mode 100644 index 000000000000..5ad15d708019 --- /dev/null +++ b/sdk/keyvault/keyvault-admin/test/README.md @@ -0,0 +1,42 @@ +# Testing + +To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md#testing). + +You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/master/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/test-resources.json) that already has all of the the necessary configurations. + +The Azure resource that is used by the tests in this project is: + +- An [Azure Key Vault](https://docs.microsoft.com/azure/key-vault/general/basic-concepts). Your Azure application needs to be assigned as the **owner** of this Azure Key Vault. The steps are provided [below](#AAD-based-authentication). + +To run the live tests, you will also need to set the below environment variables: + +- `TEST_MODE`: Should have `live` assigned. +- `AZURE_CLIENT_ID`: The client ID of an Azure Active Directory application. +- `AZURE_CLIENT_SECRET`: The client secret of an Azure Active Directory application. +- `AZURE_TENANT_ID`: The Tenant ID of your organization in Azure Active Directory. +- `KEYVAULT_URI`: The name of the key vault to use in the samples. +- `KEYVAULT_NAME`: The name of the KeyVault to use. +- `BLOB_STORAGE_URI`: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated. +- `BLOB_STORAGE_SAS_TOKEN`: URI of the Blob Storage instance, with the name of the container where the Key Vault backups will be generated. +- `CLIENT_OBJECT_ID`: Object ID of the application, tenant or principal to whom the role will be assigned to. These tests add and remove roles to and from this ID. **Do not use the same Object Id of the application, tenant or principal you're using to authenticate the client.** + +The live tests in this project will assign access roles to an Azure Key Vault, as well as generate backups and delete backups of an Azure Key Vault. + +## AAD based authentication + +The following steps will help you setup the AAD credentials. + +### Register a new application in AAD + +- Follow [Documentation to register a new application](https://docs.microsoft.com/azure/active-directory/develop/quickstart-register-app) in the Azure Active Directory (in the Azure portal). +- Note down the `CLIENT_ID` and `TENANT_ID`. +- In the "Certificates & Secrets" tab, create a secret and note that down. + +### Assign owner role to the registered application + +- In the Azure portal, go to your Azure Key Vault and assign the **Owner** role to the registered application. +- This can be done from `Role assignment` section of `Access control (IAM)` tab (in the left-side-navbar of your Azure Key Vault in the Azure portal)
+ _Doing this would allow the registered application manage the resource, i.e., entity creation, deletion, etc.,_
+- For more information on securing your Key Vault: [Learn more](https://docs.microsoft.com/azure/key-vault/general/secure-your-key-vault) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fkeyvault%2Fkeyvault-admin%2Ftest%2FREADME.png) diff --git a/sdk/keyvault/keyvault-keys/samples/javascript/README.md b/sdk/keyvault/keyvault-keys/samples/javascript/README.md index 84d45af32fc3..7699f01f7ed7 100644 --- a/sdk/keyvault/keyvault-keys/samples/javascript/README.md +++ b/sdk/keyvault/keyvault-keys/samples/javascript/README.md @@ -24,7 +24,7 @@ The samples are compatible with Node.js >= 8.0.0. You need [an Azure subscription][freesub] and [an Azure Key Vault][azkeyvault] to run these sample programs. To quickly create the needed Key Vault resources in Azure and to receive a connection string for them, you can deploy our sample template by clicking: -[![](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-sdk-for-js%2Fmaster%2Fsdk%2Fkeyvault%2Fkeyvault-certificates%2Ftests-resources.json) +[![](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-sdk-for-js%2Fmaster%2Fsdk%2Fkeyvault%2Ftests-resources.json) If creating the Key Vault manually using the Azure Portal, be aware that the samples require that the soft-delete feature be enabled. Our template above will enable this feature automatically, but it is possible to enable it manually using the Azure CLI. See [this page][kvsoftdelete] for more information. diff --git a/sdk/keyvault/keyvault-keys/samples/typescript/README.md b/sdk/keyvault/keyvault-keys/samples/typescript/README.md index 272cc215a601..ad2d535020ca 100644 --- a/sdk/keyvault/keyvault-keys/samples/typescript/README.md +++ b/sdk/keyvault/keyvault-keys/samples/typescript/README.md @@ -30,7 +30,7 @@ npm install -g typescript You need [an Azure subscription][freesub] and [an Azure Key Vault][azkeyvault] to run these sample programs. To quickly create the needed Key Vault resources in Azure and to receive a connection string for them, you can deploy our sample template by clicking: -[![](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-sdk-for-js%2Fmaster%2Fsdk%2Fkeyvault%2Fkeyvault-certificates%2Ftests-resources.json) +[![](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-sdk-for-js%2Fmaster%2Fsdk%2Fkeyvault%2Ftests-resources.json) If creating the Key Vault manually using the Azure Portal, be aware that the samples require that the soft-delete feature be enabled. Our template above will enable this feature automatically, but it is possible to enable it manually using the Azure CLI. See [this page][kvsoftdelete] for more information. From 646ee0b7c73e07559e4737416a9bd8270dc6880e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Thu, 10 Sep 2020 14:52:34 -0400 Subject: [PATCH 11/15] Replacing the BLOB_STORAGE_URI Addresses https://github.com/Azure/azure-sdk-for-js/pull/11010#discussion_r486547332 --- .../node/keyvaultbackupclient/recording_beginbackup.js | 4 ++-- .../recording_beginbackup_then_beginrestore.js | 8 ++++---- .../recording_beginbackup_then_beginselectiverestore.js | 6 +++--- sdk/keyvault/keyvault-admin/test/utils/authentication.ts | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js index cc56fcb1de05..ed07998b1b40 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js @@ -29,7 +29,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'no-cache' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) + .post('/backup', {"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599748973,"endTime":null,"jobId":"5346496aa0434106be3bdf238270a71b","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', @@ -193,7 +193,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .get('/backup/5346496aa0434106be3bdf238270a71b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014425336","endTime":1599748983,"error":null,"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014425336","endTime":1599748983,"error":null,"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js index bc7306de9f11..da0ef713e318 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js @@ -29,7 +29,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'no-cache' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) + .post('/backup', {"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599748998,"endTime":null,"jobId":"01d247c294db47229eefb189ba0b8982","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', @@ -193,7 +193,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .get('/backup/01d247c294db47229eefb189ba0b8982/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014431833","endTime":1599749008,"error":null,"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014431833","endTime":1599749008,"error":null,"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', @@ -223,7 +223,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folderToRestore":"https://chrissprim.blob.core.windows.net/backup"}) + .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folderToRestore":"https://uri.blob.core.windows.net/backup"}) .query(true) .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"56bbbdab421c4fadb3592a2fc23fcf9c","startTime":1599749010,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', @@ -259,7 +259,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .get('/backup/56bbbdab421c4fadb3592a2fc23fcf9c/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/https://chrissprim.blob.core.windows.net/backup","endTime":1599749010,"error":{"code":null,"innererror":null,"message":null},"jobId":"56bbbdab421c4fadb3592a2fc23fcf9c","startTime":1599749010,"status":"Failed","statusDetails":"Invalid backup provided"}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/https://uri.blob.core.windows.net/backup","endTime":1599749010,"error":{"code":null,"innererror":null,"message":null},"jobId":"56bbbdab421c4fadb3592a2fc23fcf9c","startTime":1599749010,"status":"Failed","statusDetails":"Invalid backup provided"}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js index dd103b711f83..f93c1a5ac681 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js @@ -79,7 +79,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'no-cache' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .post('/backup', {"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) + .post('/backup', {"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599749038,"endTime":null,"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', @@ -275,7 +275,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://chrissprim.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014435852","endTime":1599749049,"error":null,"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014435852","endTime":1599749049,"error":null,"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', @@ -305,7 +305,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .put('/keys/beginBackupthenbeginSelectiveRestore/restore', {"sasTokenParameters":{"storageResourceUri":"https://chrissprim.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folder":"https://chrissprim.blob.core.windows.net/backup"}) + .put('/keys/beginBackupthenbeginSelectiveRestore/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folder":"https://uri.blob.core.windows.net/backup"}) .query(true) .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"2e7e281982334c0ca84186d8f6f40cca","startTime":1599749052,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', diff --git a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts index 73b75d93116d..d7516ad5be09 100644 --- a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts +++ b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts @@ -28,6 +28,7 @@ export async function authenticate(that: any): Promise { AZURE_TENANT_ID: "azure_tenant_id", AZURE_CLIENT_SECRET: "azure_client_secret", CLIENT_OBJECT_ID: "01ea9a65-813e-4238-8204-bf7328d63fc6", + BLOB_STORAGE_URI: "https://uri.blob.core.windows.net/backup", BLOB_STORAGE_SAS_TOKEN: "blob_storage_sas_token", KEYVAULT_NAME: "keyvault_name", KEYVAULT_URI: "https://eastus2.keyvault_name.managedhsm-int.azure-int.net" From 94bf14fca3e63cbb3d269052a8425ea1959c1a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Thu, 10 Sep 2020 14:58:53 -0400 Subject: [PATCH 12/15] No unnecesary new credentials Removed the generation of unnecessary credentials. Addresses: - https://github.com/Azure/azure-sdk-for-js/pull/11010#discussion_r486552237 - https://github.com/Azure/azure-sdk-for-js/pull/11010#discussion_r486558280 --- .../internal/serviceVersionParameter.spec.ts | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts index 8eca0c1d8577..b52d741e4336 100644 --- a/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts @@ -36,6 +36,14 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { let spy: SinonSpy<[WebResourceLike], Promise>; let credential: ClientSecretCredential; + beforeEach(async () => { + credential = await new ClientSecretCredential( + env.AZURE_TENANT_ID!, + env.AZURE_CLIENT_ID!, + env.AZURE_CLIENT_SECRET! + ); + }); + afterEach(() => { sandbox.restore(); }); @@ -45,12 +53,6 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { mockHttpClient = makeHTTPMock("/providers/Microsoft.Authorization/roleDefinitions"); sandbox = createSandbox(); spy = sandbox.spy(mockHttpClient, "sendRequest"); - - credential = await new ClientSecretCredential( - env.AZURE_TENANT_ID!, - env.AZURE_CLIENT_ID!, - env.AZURE_CLIENT_SECRET! - ); }); it("it should default to the latest API version", async function() { @@ -67,11 +69,6 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { it("it should allow us to specify an API version from a specific set of versions", async function() { const serviceVersion = "7.2-preview"; - const credential = await new ClientSecretCredential( - env.AZURE_TENANT_ID!, - env.AZURE_CLIENT_ID!, - env.AZURE_CLIENT_SECRET! - ); const client = new KeyVaultAccessControlClient(keyVaultUrl, credential, { serviceVersion: serviceVersion as ApIVersions, httpClient: mockHttpClient @@ -92,12 +89,6 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { mockHttpClient = makeHTTPMock("/backup", 202); sandbox = createSandbox(); spy = sandbox.spy(mockHttpClient, "sendRequest"); - - credential = await new ClientSecretCredential( - env.AZURE_TENANT_ID!, - env.AZURE_CLIENT_ID!, - env.AZURE_CLIENT_SECRET! - ); }); it("it should default to the latest API version", async function() { @@ -112,11 +103,6 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { it("it should allow us to specify an API version from a specific set of versions", async function() { const serviceVersion = "7.2-preview"; - const credential = await new ClientSecretCredential( - env.AZURE_TENANT_ID!, - env.AZURE_CLIENT_ID!, - env.AZURE_CLIENT_SECRET! - ); const client = new KeyVaultBackupClient(keyVaultUrl, credential, { serviceVersion: serviceVersion as ApIVersions, httpClient: mockHttpClient From ee2e28c51b27a75c0be495246ba85d18370f2c2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Thu, 10 Sep 2020 17:22:31 -0400 Subject: [PATCH 13/15] all of the recent feedback --- ...roleassignment_and_deleteroleassignment.js | 30 +-- .../recording_listroleassignments.js | 8 +- .../recording_listroledefinitions.js | 8 +- .../recording_beginbackup.js | 96 ++++++---- ...recording_beginbackup_then_beginrestore.js | 122 ++++++++----- ..._beginbackup_then_beginselectiverestore.js | 172 +++++++++++------- .../src/lro/selectiveRestore/operation.ts | 17 +- .../internal/serviceVersionParameter.spec.ts | 26 +-- .../test/public/backupClient.spec.ts | 10 +- .../test/utils/authentication.ts | 7 +- .../keyvault-admin/test/utils/common.ts | 8 +- 11 files changed, 312 insertions(+), 192 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js index 760124fc1f2c..1a952c0bdb25 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js @@ -4,7 +4,7 @@ module.exports.hash = "dd68210585b112824dac825c061cb917"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .get('///providers/Microsoft.Authorization/roleAssignments') .query(true) .reply(401, "OK", [ 'content-type', @@ -18,7 +18,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '2', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -30,13 +30,13 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-server-latency', '1' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .get('///providers/Microsoft.Authorization/roleAssignments') .query(true) .reply(200, {"value":[{"id":"/providers/Microsoft.Authorization/roleAssignments/8e7fe831-35fe-0488-beaf-5b0866306cbb","name":"8e7fe831-35fe-0488-beaf-5b0866306cbb","properties":{"principalId":"4f584d72-47b3-48d1-971c-ce0ae8a47560","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/65e1be51-aa38-4250-967a-8658fdfb260b","name":"65e1be51-aa38-4250-967a-8658fdfb260b","properties":{"principalId":"49acc88b-8f9e-4619-9856-16691db66767","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/967a0ebd-73a1-0145-85fc-3b6514ac2581","name":"967a0ebd-73a1-0145-85fc-3b6514ac2581","properties":{"principalId":"e7941875-b7e4-4ba2-9527-d3ef2a9b58fa","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1d8e08be-5415-4c5f-94f2-22ba4f889ef7","name":"1d8e08be-5415-4c5f-94f2-22ba4f889ef7","properties":{"principalId":"c2101ce9-648a-4bbe-8f0e-3e891ff1658d","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1587adcd-1227-4799-03dc-a4194c659c07","name":"1587adcd-1227-4799-03dc-a4194c659c07","properties":{"principalId":"2bca474d-4fac-495d-919a-30376e0fe515","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/129c2001-45e7-0814-13d0-9d933e794b37","name":"129c2001-45e7-0814-13d0-9d933e794b37","properties":{"principalId":"d0596a07-8d8d-433f-a25e-5c6f46787784","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}]}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -58,13 +58,13 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-server-latency', '1' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .get('///providers/Microsoft.Authorization/roleDefinitions') .query(true) .reply(200, {"value":[{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","name":"a290e904-7015-4bba-90c8-60543313cdb4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete","Microsoft.KeyVault/managedHsm/securitydomain/download/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/read","Microsoft.KeyVault/managedHsm/securitydomain/transferkey/read","Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/restore/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/restore/status/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/515eb02d-2335-4d2d-92f2-b1cbdf9c3778","name":"515eb02d-2335-4d2d-92f2-b1cbdf9c3778","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Officer","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/21dbd100-6940-42c2-9190-5d6cb909625b","name":"21dbd100-6940-42c2-9190-5d6cb909625b","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto User","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/4bd23610-cdcf-4971-bdee-bdc562cc28e4","name":"4bd23610-cdcf-4971-bdee-bdc562cc28e4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Policy Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","name":"2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Auditor","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/33413926-3206-4cdd-b39a-83574fe37a17","name":"33413926-3206-4cdd-b39a-83574fe37a17","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Service Encryption","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","name":"7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/keys/backup/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Backup","type":""},"type":"Microsoft.Authorization/roleDefinitions"}]}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -86,7 +86,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-server-latency', '0' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .put('///providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27', {"properties":{"roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6"}}) .query(true) .reply(201, {"id":"/providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27","name":"b36b00af-89c6-435f-a43d-9a3087015c27","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'content-type', @@ -96,7 +96,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '398', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -106,19 +106,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '300', + '266', 'cache-control', 'no-cache', 'x-frame-options', 'SAMEORIGIN' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .get('///providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27') .query(true) .reply(200, {"id":"/providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27","name":"b36b00af-89c6-435f-a43d-9a3087015c27","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -138,9 +138,9 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '1' ]); + '0' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .delete('///providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27') .query(true) .reply(200, {"id":"/providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27","name":"b36b00af-89c6-435f-a43d-9a3087015c27","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'content-type', @@ -150,7 +150,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '398', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -160,7 +160,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '259', + '254', 'cache-control', 'no-cache', 'x-frame-options', diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroleassignments.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroleassignments.js index b745b7359e71..a4f444210725 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroleassignments.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroleassignments.js @@ -4,7 +4,7 @@ module.exports.hash = "40a7c9b72f55641675802c7541f1b95b"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .get('///providers/Microsoft.Authorization/roleAssignments') .query(true) .reply(401, "OK", [ 'content-type', @@ -18,7 +18,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '2', 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -30,13 +30,13 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-server-latency', '1' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .get('///providers/Microsoft.Authorization/roleAssignments') .query(true) .reply(200, {"value":[{"id":"/providers/Microsoft.Authorization/roleAssignments/8e7fe831-35fe-0488-beaf-5b0866306cbb","name":"8e7fe831-35fe-0488-beaf-5b0866306cbb","properties":{"principalId":"4f584d72-47b3-48d1-971c-ce0ae8a47560","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/65e1be51-aa38-4250-967a-8658fdfb260b","name":"65e1be51-aa38-4250-967a-8658fdfb260b","properties":{"principalId":"49acc88b-8f9e-4619-9856-16691db66767","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/967a0ebd-73a1-0145-85fc-3b6514ac2581","name":"967a0ebd-73a1-0145-85fc-3b6514ac2581","properties":{"principalId":"e7941875-b7e4-4ba2-9527-d3ef2a9b58fa","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1d8e08be-5415-4c5f-94f2-22ba4f889ef7","name":"1d8e08be-5415-4c5f-94f2-22ba4f889ef7","properties":{"principalId":"c2101ce9-648a-4bbe-8f0e-3e891ff1658d","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1587adcd-1227-4799-03dc-a4194c659c07","name":"1587adcd-1227-4799-03dc-a4194c659c07","properties":{"principalId":"2bca474d-4fac-495d-919a-30376e0fe515","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/129c2001-45e7-0814-13d0-9d933e794b37","name":"129c2001-45e7-0814-13d0-9d933e794b37","properties":{"principalId":"d0596a07-8d8d-433f-a25e-5c6f46787784","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}]}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroledefinitions.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroledefinitions.js index 68899afe0b8d..8a52e303df2c 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroledefinitions.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_listroledefinitions.js @@ -4,7 +4,7 @@ module.exports.hash = "d61a5b81560a7e21eb384041c75fb8db"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .get('///providers/Microsoft.Authorization/roleDefinitions') .query(true) .reply(401, "OK", [ 'content-type', @@ -18,7 +18,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '2', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -30,13 +30,13 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-server-latency', '1' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .get('///providers/Microsoft.Authorization/roleDefinitions') .query(true) .reply(200, {"value":[{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","name":"a290e904-7015-4bba-90c8-60543313cdb4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete","Microsoft.KeyVault/managedHsm/securitydomain/download/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/read","Microsoft.KeyVault/managedHsm/securitydomain/transferkey/read","Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/restore/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/restore/status/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/515eb02d-2335-4d2d-92f2-b1cbdf9c3778","name":"515eb02d-2335-4d2d-92f2-b1cbdf9c3778","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Officer","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/21dbd100-6940-42c2-9190-5d6cb909625b","name":"21dbd100-6940-42c2-9190-5d6cb909625b","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto User","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/4bd23610-cdcf-4971-bdee-bdc562cc28e4","name":"4bd23610-cdcf-4971-bdee-bdc562cc28e4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Policy Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","name":"2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Auditor","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/33413926-3206-4cdd-b39a-83574fe37a17","name":"33413926-3206-4cdd-b39a-83574fe37a17","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Service Encryption","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","name":"7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/keys/backup/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Backup","type":""},"type":"Microsoft.Authorization/roleDefinitions"}]}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js index ed07998b1b40..47b12f0d5864 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup.js @@ -4,13 +4,13 @@ module.exports.hash = "e4b0dbf41afd7d2a4dfe67be1421db6c"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .post('/backup') .query(true) .reply(401, "", [ 'content-type', 'application/json; charset=utf-8', 'x-ms-server-latency', - '126', + '1', 'x-content-type-options', 'nosniff', 'www-authenticate', @@ -28,19 +28,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'cache-control', 'no-cache' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .post('/backup', {"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) - .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599748973,"endTime":null,"jobId":"5346496aa0434106be3bdf238270a71b","azureStorageBlobContainerUri":null}, [ 'server', + .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599770332,"endTime":null,"jobId":"5f4fac0accea45b794bd5b5f4dc911ef","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', 'date', - 'Thu, 10 Sep 2020 14:42:53 GMT', + 'Thu, 10 Sep 2020 20:38:51 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/backup/5346496aa0434106be3bdf238270a71b/pending', + 'https://eastus2.keyvault_name.managedhsm.azure.net/backup/5f4fac0accea45b794bd5b5f4dc911ef/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', @@ -54,7 +54,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '1030', + '899', 'content-length', '216', 'strict-transport-security', @@ -62,15 +62,15 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/5346496aa0434106be3bdf238270a71b/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/5f4fac0accea45b794bd5b5f4dc911ef/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5f4fac0accea45b794bd5b5f4dc911ef","startTime":1599770332,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:42:54 GMT', + 'Thu, 10 Sep 2020 20:38:52 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -90,19 +90,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '729', + '702', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/5346496aa0434106be3bdf238270a71b/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/5f4fac0accea45b794bd5b5f4dc911ef/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5f4fac0accea45b794bd5b5f4dc911ef","startTime":1599770332,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:42:54 GMT', + 'Thu, 10 Sep 2020 20:38:53 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -122,19 +122,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '679', + '1028', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/5346496aa0434106be3bdf238270a71b/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/5f4fac0accea45b794bd5b5f4dc911ef/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5f4fac0accea45b794bd5b5f4dc911ef","startTime":1599770332,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:42:57 GMT', + 'Thu, 10 Sep 2020 20:38:57 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -154,19 +154,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '641', + '699', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/5346496aa0434106be3bdf238270a71b/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/5f4fac0accea45b794bd5b5f4dc911ef/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5f4fac0accea45b794bd5b5f4dc911ef","startTime":1599770332,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:43:00 GMT', + 'Thu, 10 Sep 2020 20:38:59 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -186,19 +186,51 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '681', + '655', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/5346496aa0434106be3bdf238270a71b/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/5f4fac0accea45b794bd5b5f4dc911ef/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014425336","endTime":1599748983,"error":null,"jobId":"5346496aa0434106be3bdf238270a71b","startTime":1599748973,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"5f4fac0accea45b794bd5b5f4dc911ef","startTime":1599770332,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:43:03 GMT', + 'Thu, 10 Sep 2020 20:39:01 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '216', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '621', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/5f4fac0accea45b794bd5b5f4dc911ef/pending') + .query(true) + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091020385266","endTime":1599770343,"error":null,"jobId":"5f4fac0accea45b794bd5b5f4dc911ef","startTime":1599770332,"status":"Succeeded","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Thu, 10 Sep 2020 20:39:05 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -218,6 +250,6 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '641', + '626', 'content-security-policy', 'default-src \'self\'' ]); diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js index da0ef713e318..41d0f8815d87 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js @@ -1,16 +1,16 @@ let nock = require('nock'); -module.exports.hash = "87ec569939613131fb5563a8d147f982"; +module.exports.hash = "a4e4a35064fa9135b6d909b5b93496b9"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .post('/backup') .query(true) .reply(401, "", [ 'content-type', 'application/json; charset=utf-8', 'x-ms-server-latency', - '1', + '0', 'x-content-type-options', 'nosniff', 'www-authenticate', @@ -28,19 +28,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'cache-control', 'no-cache' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .post('/backup', {"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) - .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599748998,"endTime":null,"jobId":"01d247c294db47229eefb189ba0b8982","azureStorageBlobContainerUri":null}, [ 'server', + .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599772276,"endTime":null,"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', 'date', - 'Thu, 10 Sep 2020 14:43:18 GMT', + 'Thu, 10 Sep 2020 21:11:16 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/backup/01d247c294db47229eefb189ba0b8982/pending', + 'https://eastus2.keyvault_name.managedhsm.azure.net/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', @@ -54,23 +54,55 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '972', + '890', + 'content-length', + '216', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') + .query(true) + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Thu, 10 Sep 2020 21:11:16 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', 'content-length', '216', 'strict-transport-security', 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '680', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/01d247c294db47229eefb189ba0b8982/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:43:18 GMT', + 'Thu, 10 Sep 2020 21:11:17 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -90,19 +122,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '678', + '625', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/01d247c294db47229eefb189ba0b8982/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:43:19 GMT', + 'Thu, 10 Sep 2020 21:11:19 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -122,19 +154,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '639', + '631', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/01d247c294db47229eefb189ba0b8982/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:43:22 GMT', + 'Thu, 10 Sep 2020 21:11:22 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -154,19 +186,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '654', + '645', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/01d247c294db47229eefb189ba0b8982/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:43:25 GMT', + 'Thu, 10 Sep 2020 21:11:25 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -186,19 +218,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '620', + '645', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/01d247c294db47229eefb189ba0b8982/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014431833","endTime":1599749008,"error":null,"jobId":"01d247c294db47229eefb189ba0b8982","startTime":1599748998,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091021111625","endTime":1599772286,"error":null,"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:43:28 GMT', + 'Thu, 10 Sep 2020 21:11:28 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -218,23 +250,23 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '627', + '610', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folderToRestore":"https://uri.blob.core.windows.net/backup"}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folderToRestore":"backup"}) .query(true) - .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"56bbbdab421c4fadb3592a2fc23fcf9c","startTime":1599749010,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"bfa3388fabdb41b691170ab489da8cb2","startTime":1599772289,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'date', - 'Thu, 10 Sep 2020 14:43:30 GMT', + 'Thu, 10 Sep 2020 21:11:28 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/restore/56bbbdab421c4fadb3592a2fc23fcf9c/pending', + 'https://eastus2.keyvault_name.managedhsm.azure.net/restore/bfa3388fabdb41b691170ab489da8cb2/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', @@ -248,7 +280,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '823', + '805', 'content-length', '180', 'strict-transport-security', @@ -256,15 +288,15 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/56bbbdab421c4fadb3592a2fc23fcf9c/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/bfa3388fabdb41b691170ab489da8cb2/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/https://uri.blob.core.windows.net/backup","endTime":1599749010,"error":{"code":null,"innererror":null,"message":null},"jobId":"56bbbdab421c4fadb3592a2fc23fcf9c","startTime":1599749010,"status":"Failed","statusDetails":"Invalid backup provided"}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/backup","endTime":1599772289,"error":{"code":null,"innererror":null,"message":null},"jobId":"bfa3388fabdb41b691170ab489da8cb2","startTime":1599772289,"status":"Failed","statusDetails":"Invalid backup provided"}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:43:30 GMT', + 'Thu, 10 Sep 2020 21:11:29 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -278,12 +310,12 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-frame-options', 'SAMEORIGIN', 'content-length', - '332', + '291', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '637', + '665', 'content-security-policy', 'default-src \'self\'' ]); diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js index f93c1a5ac681..ed6c9285afc7 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js @@ -1,16 +1,16 @@ let nock = require('nock'); -module.exports.hash = "908147e0f531c6948ff29890bdb04724"; +module.exports.hash = "e010f163c077c8a3e782ae2b4b5991d1"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .post('/keys/beginBackupthenbeginSelectiveRestore/create') .query(true) .reply(401, "", [ 'content-type', 'application/json; charset=utf-8', 'x-ms-server-latency', - '1', + '2', 'x-content-type-options', 'nosniff', 'www-authenticate', @@ -20,7 +20,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '0', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -28,17 +28,17 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'cache-control', 'no-cache' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .post('/keys/beginBackupthenbeginSelectiveRestore/create', {"kty":"RSA"}) .query(true) - .reply(200, {"attributes":{"created":1599749024,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599749024},"key":{"e":"AQAB","key_ops":["wrapKey","decrypt","encrypt","unwrapKey","sign","verify"],"kid":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/keys/beginBackupthenbeginSelectiveRestore/13cd12b2b86401872fb5828577ec40bb","kty":"RSA-HSM","n":"i5UMbpILEmoGVyS-WpzaloXsUjfhlQ9ss7yemxOGghcT6z2rXblAm3ZXvglrrz7CN_u0qZ_3246gG7Yr6EM-x6hDNgpLOBVMiUHAubp75cDqC14RNis9J16nnhmfTw3cMdvk9w2Tf4iIl7UrwQTXen-yPnoGrixvIBGrTPX-9cheOASXodEqCGaoZi0YyPc0XP0-_efs_QVqQCy6a6HJifndaQlvQ0u0kj_9jqGI4zYm0deaAxHsRYpO7p0Ae7qOPgn4TmmDPvYPdLo5PdtOjGEuVnhA3DPSuwV7jKJtOLRdkch3QBzMVkg1_ChErnE2RKY3afiQF1QKfVbbqdYCCw"}}, [ 'content-type', + .reply(200, {"attributes":{"created":1599772302,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599772302},"key":{"e":"AQAB","key_ops":["wrapKey","decrypt","encrypt","unwrapKey","sign","verify"],"kid":"https://eastus2.keyvault_name.managedhsm.azure.net/keys/beginBackupthenbeginSelectiveRestore/103dbfbac8a601bc9ee20f7dcb35535a","kty":"RSA-HSM","n":"vK0p6QSHXodfOhTvPTkXUvkt8Gn4fLlMFMIkF7K3GpBhEZfuS_nAmHWs_jRD7kgL25X9ycjJE-OrBdKjmRvmHnezwE0jU4vEIf15NMY3UbQSnLjfmYDnjipgTyuLpU3x0FyxjwwZCewEgyJ-LFj2UqOCZSWbsVBSDpZOSz-aPmXGR7eJTpLM-dvNfkL6y488-SmBu0tslfRs9E73v4lOhsCSqLfEqMOMpHWvCgQ9kUqw9P5NHwFI52eesNe-XwF_N-XpiQqPeh1DgDfIBDpUHlEtFZUj_qJjSDoIbnO-tkK-dOYdVn4Uycju-i64p-6XdYSHljjylWHKQ1eRIdZU4Q"}}, [ 'content-type', 'application/json; charset=utf-8', 'x-content-type-options', 'nosniff', 'content-length', '755', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -48,13 +48,13 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '693', + '675', 'cache-control', 'no-cache', 'x-frame-options', 'SAMEORIGIN' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .post('/backup') .query(true) .reply(401, "", [ 'content-type', @@ -70,7 +70,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '0', 'x-ms-request-id', - 'e6aeb748-f2ae-11ea-857a-0242ac120004', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -78,25 +78,25 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'cache-control', 'no-cache' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .post('/backup', {"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) - .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599749038,"endTime":null,"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","azureStorageBlobContainerUri":null}, [ 'server', + .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599772315,"endTime":null,"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', 'date', - 'Thu, 10 Sep 2020 14:43:58 GMT', + 'Thu, 10 Sep 2020 21:11:54 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending', + 'https://eastus2.keyvault_name.managedhsm.azure.net/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', '10', 'x-ms-request-id', - 'e6aeb748-f2ae-11ea-857a-0242ac120004', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -104,7 +104,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '838', + '900', 'content-length', '216', 'strict-transport-security', @@ -112,15 +112,15 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:43:59 GMT', + 'Thu, 10 Sep 2020 21:11:55 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -128,7 +128,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - 'e6aeb748-f2ae-11ea-857a-0242ac120004', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -140,19 +140,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '755', + '600', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:44:00 GMT', + 'Thu, 10 Sep 2020 21:11:56 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -160,7 +160,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - 'e6aeb748-f2ae-11ea-857a-0242ac120004', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -172,19 +172,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '653', + '673', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:44:02 GMT', + 'Thu, 10 Sep 2020 21:11:58 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -192,7 +192,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - 'e6aeb748-f2ae-11ea-857a-0242ac120004', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -204,19 +204,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '645', + '617', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:44:05 GMT', + 'Thu, 10 Sep 2020 21:12:01 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -224,7 +224,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - 'e6aeb748-f2ae-11ea-857a-0242ac120004', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -236,19 +236,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '653', + '658', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:44:08 GMT', + 'Thu, 10 Sep 2020 21:12:04 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -256,7 +256,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - 'e6aeb748-f2ae-11ea-857a-0242ac120004', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -268,19 +268,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '661', + '633', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .get('/backup/05ce6eb2019647feb2d82d8d05b2ef5a/pending') +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091014435852","endTime":1599749049,"error":null,"jobId":"05ce6eb2019647feb2d82d8d05b2ef5a","startTime":1599749038,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091021115530","endTime":1599772325,"error":null,"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 14:44:11 GMT', + 'Thu, 10 Sep 2020 21:12:06 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -288,7 +288,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - 'e6aeb748-f2ae-11ea-857a-0242ac120004', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -300,29 +300,29 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '634', + '650', 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) - .put('/keys/beginBackupthenbeginSelectiveRestore/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folder":"https://uri.blob.core.windows.net/backup"}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .put('/keys/beginBackupthenbeginSelectiveRestore/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folder":"backup"}) .query(true) - .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"2e7e281982334c0ca84186d8f6f40cca","startTime":1599749052,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"38c9569672334ec8b5b752b9235fe864","startTime":1599772328,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'date', - 'Thu, 10 Sep 2020 14:44:12 GMT', + 'Thu, 10 Sep 2020 21:12:07 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm-int.azure-int.net/restore/2e7e281982334c0ca84186d8f6f40cca/pending', + 'https://eastus2.keyvault_name.managedhsm.azure.net/restore/38c9569672334ec8b5b752b9235fe864/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', '10', 'x-ms-request-id', - 'e6aeb748-f2ae-11ea-857a-0242ac120004', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -330,7 +330,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '903', + '826', 'content-length', '180', 'strict-transport-security', @@ -338,17 +338,49 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-security-policy', 'default-src \'self\'' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/backup/38c9569672334ec8b5b752b9235fe864/pending') + .query(true) + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/backup","endTime":1599772328,"error":{"code":null,"innererror":null,"message":null},"jobId":"38c9569672334ec8b5b752b9235fe864","startTime":1599772328,"status":"Failed","statusDetails":"Invalid backup provided"}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Thu, 10 Sep 2020 21:12:08 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '291', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '632', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .delete('/keys/beginBackupthenbeginSelectiveRestore') .query(true) - .reply(200, {"attributes":{"created":1599749024,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599749024},"deletedDate":1599749053,"key":{"e":"AQAB","key_ops":["wrapKey","verify","sign","unwrapKey","decrypt","encrypt"],"kid":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/keys/beginBackupthenbeginSelectiveRestore/13cd12b2b86401872fb5828577ec40bb","kty":"RSA-HSM","n":"i5UMbpILEmoGVyS-WpzaloXsUjfhlQ9ss7yemxOGghcT6z2rXblAm3ZXvglrrz7CN_u0qZ_3246gG7Yr6EM-x6hDNgpLOBVMiUHAubp75cDqC14RNis9J16nnhmfTw3cMdvk9w2Tf4iIl7UrwQTXen-yPnoGrixvIBGrTPX-9cheOASXodEqCGaoZi0YyPc0XP0-_efs_QVqQCy6a6HJifndaQlvQ0u0kj_9jqGI4zYm0deaAxHsRYpO7p0Ae7qOPgn4TmmDPvYPdLo5PdtOjGEuVnhA3DPSuwV7jKJtOLRdkch3QBzMVkg1_ChErnE2RKY3afiQF1QKfVbbqdYCCw"},"recoveryId":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1600353853}, [ 'content-type', + .reply(200, {"attributes":{"created":1599772302,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599772302},"deletedDate":1599772329,"key":{"e":"AQAB","key_ops":["wrapKey","verify","sign","unwrapKey","decrypt","encrypt"],"kid":"https://eastus2.keyvault_name.managedhsm.azure.net/keys/beginBackupthenbeginSelectiveRestore/103dbfbac8a601bc9ee20f7dcb35535a","kty":"RSA-HSM","n":"vK0p6QSHXodfOhTvPTkXUvkt8Gn4fLlMFMIkF7K3GpBhEZfuS_nAmHWs_jRD7kgL25X9ycjJE-OrBdKjmRvmHnezwE0jU4vEIf15NMY3UbQSnLjfmYDnjipgTyuLpU3x0FyxjwwZCewEgyJ-LFj2UqOCZSWbsVBSDpZOSz-aPmXGR7eJTpLM-dvNfkL6y488-SmBu0tslfRs9E73v4lOhsCSqLfEqMOMpHWvCgQ9kUqw9P5NHwFI52eesNe-XwF_N-XpiQqPeh1DgDfIBDpUHlEtFZUj_qJjSDoIbnO-tkK-dOYdVn4Uycju-i64p-6XdYSHljjylWHKQ1eRIdZU4Q"},"recoveryId":"https://eastus2.keyvault_name.managedhsm.azure.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1600377129}, [ 'content-type', 'application/json; charset=utf-8', 'x-content-type-options', 'nosniff', 'content-length', '932', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -358,19 +390,19 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '456', + '463', 'cache-control', 'no-cache', 'x-frame-options', 'SAMEORIGIN' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .get('/deletedkeys/beginBackupthenbeginSelectiveRestore') .query(true) - .reply(200, {"attributes":{"created":1599749024,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599749024},"deletedDate":1599749053,"key":{"e":"AQAB","key_ops":["encrypt","decrypt","unwrapKey","sign","verify","wrapKey"],"kid":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/keys/beginBackupthenbeginSelectiveRestore/13cd12b2b86401872fb5828577ec40bb","kty":"RSA-HSM","n":"i5UMbpILEmoGVyS-WpzaloXsUjfhlQ9ss7yemxOGghcT6z2rXblAm3ZXvglrrz7CN_u0qZ_3246gG7Yr6EM-x6hDNgpLOBVMiUHAubp75cDqC14RNis9J16nnhmfTw3cMdvk9w2Tf4iIl7UrwQTXen-yPnoGrixvIBGrTPX-9cheOASXodEqCGaoZi0YyPc0XP0-_efs_QVqQCy6a6HJifndaQlvQ0u0kj_9jqGI4zYm0deaAxHsRYpO7p0Ae7qOPgn4TmmDPvYPdLo5PdtOjGEuVnhA3DPSuwV7jKJtOLRdkch3QBzMVkg1_ChErnE2RKY3afiQF1QKfVbbqdYCCw"},"recoveryId":"https://eastus2.keyvault_name.managedhsm-int.azure-int.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1600353853}, [ 'x-frame-options', + .reply(200, {"attributes":{"created":1599772302,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599772302},"deletedDate":1599772329,"key":{"e":"AQAB","key_ops":["encrypt","decrypt","unwrapKey","sign","verify","wrapKey"],"kid":"https://eastus2.keyvault_name.managedhsm.azure.net/keys/beginBackupthenbeginSelectiveRestore/103dbfbac8a601bc9ee20f7dcb35535a","kty":"RSA-HSM","n":"vK0p6QSHXodfOhTvPTkXUvkt8Gn4fLlMFMIkF7K3GpBhEZfuS_nAmHWs_jRD7kgL25X9ycjJE-OrBdKjmRvmHnezwE0jU4vEIf15NMY3UbQSnLjfmYDnjipgTyuLpU3x0FyxjwwZCewEgyJ-LFj2UqOCZSWbsVBSDpZOSz-aPmXGR7eJTpLM-dvNfkL6y488-SmBu0tslfRs9E73v4lOhsCSqLfEqMOMpHWvCgQ9kUqw9P5NHwFI52eesNe-XwF_N-XpiQqPeh1DgDfIBDpUHlEtFZUj_qJjSDoIbnO-tkK-dOYdVn4Uycju-i64p-6XdYSHljjylWHKQ1eRIdZU4Q"},"recoveryId":"https://eastus2.keyvault_name.managedhsm.azure.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1600377129}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -390,9 +422,9 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '194' ]); + '175' ]); -nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encodedQueryParams":true}) +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .delete('/deletedkeys/beginBackupthenbeginSelectiveRestore') .query(true) .reply(204, "", [ 'content-type', @@ -402,7 +434,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'content-length', '0', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -412,7 +444,7 @@ nock('https://eastus2.keyvault_name.managedhsm-int.azure-int.net:443', {"encoded 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '597', + '529', 'cache-control', 'no-cache', 'x-frame-options', diff --git a/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts b/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts index 55de83fc770e..879619c48de2 100644 --- a/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts +++ b/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts @@ -178,7 +178,7 @@ async function update( } }); - const { startTime, jobId, endTime, error } = selectiveRestoreOperation; + const { startTime, jobId, endTime, error, status, statusDetails } = selectiveRestoreOperation; if (!startTime) { state.error = new Error(`Missing "startTime" from the full restore operation.`); @@ -190,13 +190,13 @@ async function update( state.jobId = jobId; state.endTime = endTime; state.startTime = startTime; - state.status = selectiveRestoreOperation.status; - state.statusDetails = selectiveRestoreOperation.statusDetails; + state.status = status; + state.statusDetails = statusDetails; if (endTime) { state.isCompleted = true; } - if (error) { + if (error && error.message) { state.isCompleted = true; state.error = new Error(error.message); } @@ -212,11 +212,16 @@ async function update( const selectiveRestoreOperation = await fullRestoreStatus(client, vaultUrl, state.jobId, { requestOptions }); - const { endTime, error } = selectiveRestoreOperation; + const { endTime, status, statusDetails, error } = selectiveRestoreOperation; + + state.endTime = endTime; + state.status = status; + state.statusDetails = statusDetails; + if (endTime) { state.isCompleted = true; } - if (error) { + if (error && error.message) { state.isCompleted = true; state.error = new Error(error.message); } diff --git a/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts index b52d741e4336..8551108d1b31 100644 --- a/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/internal/serviceVersionParameter.spec.ts @@ -13,8 +13,6 @@ import { env } from "@azure/test-utils-recorder"; type ApIVersions = "7.2-preview"; describe("The keyvault-admin clients should set the serviceVersion", () => { - const keyVaultUrl = `https://eastus2.keyvault_name.managedhsm-int.azure-int.net`; - function makeHTTPMock(path: string, status = 200): HttpClient { return { async sendRequest(httpRequest: WebResourceLike): Promise { @@ -23,7 +21,7 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { headers: new HttpHeaders(), request: httpRequest, parsedBody: { - id: `${keyVaultUrl}${path}`, + id: `${env.KEYVAULT_URI}${path}`, attributes: {} } }; @@ -56,20 +54,20 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { }); it("it should default to the latest API version", async function() { - const client = new KeyVaultAccessControlClient(keyVaultUrl, credential, { + const client = new KeyVaultAccessControlClient(env.KEYVAULT_URI, credential, { httpClient: mockHttpClient }); await client.listRoleDefinitions("/").next(); const calls = spy.getCalls(); assert.equal( calls[0].args[0].url, - `${keyVaultUrl}///providers/Microsoft.Authorization/roleDefinitions?api-version=${LATEST_API_VERSION}` + `${env.KEYVAULT_URI}///providers/Microsoft.Authorization/roleDefinitions?api-version=${LATEST_API_VERSION}` ); }); it("it should allow us to specify an API version from a specific set of versions", async function() { const serviceVersion = "7.2-preview"; - const client = new KeyVaultAccessControlClient(keyVaultUrl, credential, { + const client = new KeyVaultAccessControlClient(env.KEYVAULT_URI, credential, { serviceVersion: serviceVersion as ApIVersions, httpClient: mockHttpClient }); @@ -79,7 +77,7 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { const lastCall = calls[calls.length - 1]; assert.equal( lastCall.args[0].url, - `${keyVaultUrl}///providers/Microsoft.Authorization/roleDefinitions?api-version=${serviceVersion}` + `${env.KEYVAULT_URI}///providers/Microsoft.Authorization/roleDefinitions?api-version=${serviceVersion}` ); }); }); @@ -92,18 +90,21 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { }); it("it should default to the latest API version", async function() { - const client = new KeyVaultBackupClient(keyVaultUrl, credential, { + const client = new KeyVaultBackupClient(env.KEYVAULT_URI, credential, { httpClient: mockHttpClient }); await client.beginBackup("secretName", "value"); const calls = spy.getCalls(); - assert.equal(calls[0].args[0].url, `${keyVaultUrl}/backup?api-version=${LATEST_API_VERSION}`); + assert.equal( + calls[0].args[0].url, + `${env.KEYVAULT_URI}/backup?api-version=${LATEST_API_VERSION}` + ); }); it("it should allow us to specify an API version from a specific set of versions", async function() { const serviceVersion = "7.2-preview"; - const client = new KeyVaultBackupClient(keyVaultUrl, credential, { + const client = new KeyVaultBackupClient(env.KEYVAULT_URI, credential, { serviceVersion: serviceVersion as ApIVersions, httpClient: mockHttpClient }); @@ -111,7 +112,10 @@ describe("The keyvault-admin clients should set the serviceVersion", () => { const calls = spy.getCalls(); const lastCall = calls[calls.length - 1]; - assert.equal(lastCall.args[0].url, `${keyVaultUrl}/backup?api-version=${serviceVersion}`); + assert.equal( + lastCall.args[0].url, + `${env.KEYVAULT_URI}/backup?api-version=${serviceVersion}` + ); }); }); }); diff --git a/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts index 9d6a427930e3..40c2665fe37c 100644 --- a/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts @@ -43,7 +43,7 @@ describe("KeyVaultBackupClient", () => { const backupURI = await backupPoller.pollUntilDone(); assert.ok(!!backupURI.match(blobStorageUri)); - const folderName = getFolderName(blobStorageUri); + const folderName = getFolderName(backupURI); const restorePoller = await client.beginRestore( blobStorageUri, sasToken, @@ -51,6 +51,9 @@ describe("KeyVaultBackupClient", () => { testPollerProperties ); await restorePoller.pollUntilDone(); + const operationState = restorePoller.getOperationState(); + assert.equal(operationState.isCompleted, true); + assert.equal(operationState.error, undefined); }); it("beginBackup, then beginSelectiveRestore", async function() { @@ -64,7 +67,7 @@ describe("KeyVaultBackupClient", () => { const backupURI = await backupPoller.pollUntilDone(); assert.ok(!!backupURI.match(blobStorageUri)); - const folderName = getFolderName(blobStorageUri); + const folderName = getFolderName(backupURI); const selectiveRestorePoller = await client.beginSelectiveRestore( blobStorageUri, sasToken, @@ -73,6 +76,9 @@ describe("KeyVaultBackupClient", () => { testPollerProperties ); await selectiveRestorePoller.pollUntilDone(); + const operationState = selectiveRestorePoller.getOperationState(); + assert.equal(operationState.isCompleted, true); + assert.equal(operationState.error, undefined); const deleteKeyPoller = await keyClient.beginDeleteKey(keyName); await deleteKeyPoller.pollUntilDone(); diff --git a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts index d7516ad5be09..c085f51ed3bb 100644 --- a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts +++ b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts @@ -31,13 +31,18 @@ export async function authenticate(that: any): Promise { BLOB_STORAGE_URI: "https://uri.blob.core.windows.net/backup", BLOB_STORAGE_SAS_TOKEN: "blob_storage_sas_token", KEYVAULT_NAME: "keyvault_name", - KEYVAULT_URI: "https://eastus2.keyvault_name.managedhsm-int.azure-int.net" + KEYVAULT_URI: "https://eastus2.keyvault_name.managedhsm.azure.net" }, customizationsOnRecordings: [ (recording: any): any => recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`), (recording: any): any => secretSuffix === "" ? recording : recording.replace(new RegExp(secretSuffix, "g"), ""), + (recording: any): any => + recording.replace( + /keyvault_name\.[a-z-]+\.azure[a-z-]*\.net/g, + `keyvault_name.managedhsm.azure.net` + ), (recording: any): any => { for (const uuid of generatedUUIDs) { recording = recording.replace( diff --git a/sdk/keyvault/keyvault-admin/test/utils/common.ts b/sdk/keyvault/keyvault-admin/test/utils/common.ts index e63792df5573..cc8136708bf7 100644 --- a/sdk/keyvault/keyvault-admin/test/utils/common.ts +++ b/sdk/keyvault/keyvault-admin/test/utils/common.ts @@ -48,6 +48,10 @@ export function formatName(name: string): string { return name.replace(/[^0-9a-zA-Z-]/g, ""); } -export function getFolderName(storageURI: string): string { - return storageURI; // TODO +// Receives: +// https://uri.blob.core.windows.net/backup/ +// Splits into: +// https: uri.blob.core.windows.net backup +export function getFolderName(uri: string): string { + return uri.split("/")[3]; } From 94f4fb025932b71249d588ccb8ea46927d0e85fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Thu, 10 Sep 2020 17:42:57 -0400 Subject: [PATCH 14/15] addressing https://github.com/Azure/azure-sdk-for-js/pull/11010#discussion_r486564346 --- ...roleassignment_and_deleteroleassignment.js | 44 ++++++++++++++----- .../test/public/accessControlClient.spec.ts | 8 ++++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js index 1a952c0bdb25..ca959bf29e30 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultaccesscontrolclient/recording_createroleassignment_getroleassignment_and_deleteroleassignment.js @@ -1,6 +1,6 @@ let nock = require('nock'); -module.exports.hash = "dd68210585b112824dac825c061cb917"; +module.exports.hash = "b2324b2ce082cf85b4d733d70669171a"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} @@ -18,7 +18,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'content-length', '2', 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -36,7 +36,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar .reply(200, {"value":[{"id":"/providers/Microsoft.Authorization/roleAssignments/8e7fe831-35fe-0488-beaf-5b0866306cbb","name":"8e7fe831-35fe-0488-beaf-5b0866306cbb","properties":{"principalId":"4f584d72-47b3-48d1-971c-ce0ae8a47560","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/65e1be51-aa38-4250-967a-8658fdfb260b","name":"65e1be51-aa38-4250-967a-8658fdfb260b","properties":{"principalId":"49acc88b-8f9e-4619-9856-16691db66767","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/967a0ebd-73a1-0145-85fc-3b6514ac2581","name":"967a0ebd-73a1-0145-85fc-3b6514ac2581","properties":{"principalId":"e7941875-b7e4-4ba2-9527-d3ef2a9b58fa","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1d8e08be-5415-4c5f-94f2-22ba4f889ef7","name":"1d8e08be-5415-4c5f-94f2-22ba4f889ef7","properties":{"principalId":"c2101ce9-648a-4bbe-8f0e-3e891ff1658d","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/1587adcd-1227-4799-03dc-a4194c659c07","name":"1587adcd-1227-4799-03dc-a4194c659c07","properties":{"principalId":"2bca474d-4fac-495d-919a-30376e0fe515","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"},{"id":"/providers/Microsoft.Authorization/roleAssignments/129c2001-45e7-0814-13d0-9d933e794b37","name":"129c2001-45e7-0814-13d0-9d933e794b37","properties":{"principalId":"d0596a07-8d8d-433f-a25e-5c6f46787784","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}]}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -64,7 +64,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar .reply(200, {"value":[{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","name":"a290e904-7015-4bba-90c8-60543313cdb4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete","Microsoft.KeyVault/managedHsm/securitydomain/download/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/action","Microsoft.KeyVault/managedHsm/securitydomain/upload/read","Microsoft.KeyVault/managedHsm/securitydomain/transferkey/read","Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/restore/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/restore/status/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/515eb02d-2335-4d2d-92f2-b1cbdf9c3778","name":"515eb02d-2335-4d2d-92f2-b1cbdf9c3778","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/recover/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/restore/action","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/delete","Microsoft.KeyVault/managedHsm/keys/export/action","Microsoft.KeyVault/managedHsm/keys/import/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Officer","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/21dbd100-6940-42c2-9190-5d6cb909625b","name":"21dbd100-6940-42c2-9190-5d6cb909625b","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/write/action","Microsoft.KeyVault/managedHsm/keys/backup/action","Microsoft.KeyVault/managedHsm/keys/create","Microsoft.KeyVault/managedHsm/keys/encrypt/action","Microsoft.KeyVault/managedHsm/keys/decrypt/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action","Microsoft.KeyVault/managedHsm/keys/sign/action","Microsoft.KeyVault/managedHsm/keys/verify/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto User","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/4bd23610-cdcf-4971-bdee-bdc562cc28e4","name":"4bd23610-cdcf-4971-bdee-bdc562cc28e4","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/roleDefinitions/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/read/action","Microsoft.KeyVault/managedHsm/roleAssignments/write/action","Microsoft.KeyVault/managedHsm/roleAssignments/delete/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Policy Administrator","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","name":"2c18b078-7c48-4d3a-af88-5a3a1b3f82b3","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/deletedKeys/read/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Auditor","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/33413926-3206-4cdd-b39a-83574fe37a17","name":"33413926-3206-4cdd-b39a-83574fe37a17","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/keys/read/action","Microsoft.KeyVault/managedHsm/keys/wrap/action","Microsoft.KeyVault/managedHsm/keys/unwrap/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Crypto Service Encryption","type":""},"type":"Microsoft.Authorization/roleDefinitions"},{"id":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","name":"7b127d3c-77bd-4e3e-bbe0-dbb8971fa7f8","properties":{"assignableScopes":["/"],"description":"","permissions":[{"actions":[],"dataActions":["Microsoft.KeyVault/managedHsm/backup/start/action","Microsoft.KeyVault/managedHsm/backup/status/action","Microsoft.KeyVault/managedHsm/keys/backup/action"],"notActions":[],"notDataActions":[]}],"roleName":"Managed HSM Backup","type":""},"type":"Microsoft.Authorization/roleDefinitions"}]}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -84,7 +84,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '0' ]); + '1' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .put('///providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27', {"properties":{"roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6"}}) @@ -96,7 +96,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'content-length', '398', 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -106,7 +106,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '266', + '282', 'cache-control', 'no-cache', 'x-frame-options', @@ -118,7 +118,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar .reply(200, {"id":"/providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27","name":"b36b00af-89c6-435f-a43d-9a3087015c27","properties":{"principalId":"01ea9a65-813e-4238-8204-bf7328d63fc6","roleDefinitionId":"Microsoft.KeyVault/providers/Microsoft.Authorization/roleDefinitions/a290e904-7015-4bba-90c8-60543313cdb4","scope":"/"},"type":"Microsoft.Authorization/roleAssignments"}, [ 'x-frame-options', 'SAMEORIGIN', 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'content-type', 'application/json; charset=utf-8', 'x-ms-keyvault-region', @@ -150,7 +150,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'content-length', '398', 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', 'x-ms-keyvault-region', 'EASTUS', 'strict-transport-security', @@ -160,7 +160,31 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '254', + '286', + 'cache-control', + 'no-cache', + 'x-frame-options', + 'SAMEORIGIN' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('///providers/Microsoft.Authorization/roleAssignments/b36b00af-89c6-435f-a43d-9a3087015c27') + .query(true) + .reply(404, {"error":{"code":"RoleAssignmentNotFound","message":"Requested role assignment not found (Activity ID: e6aeb748-f2ae-11ea-857a-0242ac120004)"}}, [ 'content-type', + 'application/json; charset=utf-8', + 'x-ms-server-latency', + '0', + 'x-content-type-options', + 'nosniff', + 'content-length', + '143', + 'x-ms-request-id', + 'e6aeb748-f2ae-11ea-857a-0242ac120004', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'content-security-policy', + 'default-src \'self\'', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', 'cache-control', 'no-cache', 'x-frame-options', diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts index 84332c8eb740..c67d80c1f8e6 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts @@ -103,5 +103,13 @@ describe("KeyVaultAccessControlClient", () => { assert.equal(assignment.name, name); assert.equal(assignment.properties?.roleDefinitionId, roleDefinition.id); assert.equal(assignment.properties?.principalId, env.CLIENT_OBJECT_ID); + + let error: Error; + try { + await client.getRoleAssignment(globalScope, name); + } catch(e) { + error = e; + } + assert.ok(error!.message.match(/Requested role assignment not found/)) }); }); From 0ea78a74caa5f7af3b7cfe04050aeaed8663bca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez?= Date: Thu, 10 Sep 2020 20:22:12 -0400 Subject: [PATCH 15/15] formatting --- sdk/keyvault/keyvault-admin/package.json | 3 +- .../recording_can_abort_beginrestore.js | 2 +- ...cording_can_abort_beginselectiverestore.js | 2 +- ...recording_beginbackup_then_beginrestore.js | 292 ++++++++++++--- ..._beginbackup_then_beginselectiverestore.js | 344 +++++++++++------- .../keyvault-admin/src/backupClient.ts | 4 +- .../src/lro/restore/operation.ts | 16 +- .../src/lro/selectiveRestore/operation.ts | 14 +- .../test/public/accessControlClient.spec.ts | 4 +- .../test/public/backupClient.abort.spec.ts | 8 +- .../test/public/backupClient.spec.ts | 15 +- .../test/utils/authentication.ts | 8 +- .../keyvault-admin/test/utils/common.ts | 6 +- 13 files changed, 499 insertions(+), 219 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/package.json b/sdk/keyvault/keyvault-admin/package.json index 21abd3091396..8979ec4078b6 100644 --- a/sdk/keyvault/keyvault-admin/package.json +++ b/sdk/keyvault/keyvault-admin/package.json @@ -85,8 +85,7 @@ "@azure/core-tracing": "1.0.0-preview.9", "@azure/logger": "^1.0.0", "@opentelemetry/api": "^0.10.2", - "tslib": "^2.0.0", - "@azure/keyvault-keys": "~4.1.1" + "tslib": "^2.0.0" }, "devDependencies": { "@azure/abort-controller": "^1.0.0", diff --git a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginrestore.js b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginrestore.js index cd5d936fe3cd..9d69dc24942f 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginrestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginrestore.js @@ -1,5 +1,5 @@ let nock = require('nock'); -module.exports.hash = "85a18fed9d731e7bdf8af001fea5214d"; +module.exports.hash = "d345f80e74935ab301fc31ca6bf7094d"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js index 9bac56880e18..2117ac42c366 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/aborting_keyvaultbackupclients_requests/recording_can_abort_beginselectiverestore.js @@ -1,5 +1,5 @@ let nock = require('nock'); -module.exports.hash = "da4bd9e6492febca8f9d8a2d0c8d9074"; +module.exports.hash = "0511fd757ec5a9e376201f78f7ed3d9a"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js index 41d0f8815d87..afdd5b02e67c 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginrestore.js @@ -1,6 +1,6 @@ let nock = require('nock'); -module.exports.hash = "a4e4a35064fa9135b6d909b5b93496b9"; +module.exports.hash = "70d5e0593f5b01d12fe07ce6fe554e94"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} @@ -10,7 +10,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar .reply(401, "", [ 'content-type', 'application/json; charset=utf-8', 'x-ms-server-latency', - '0', + '3', 'x-content-type-options', 'nosniff', 'www-authenticate', @@ -20,7 +20,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'content-length', '0', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', @@ -31,22 +31,22 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) .post('/backup', {"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) - .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599772276,"endTime":null,"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","azureStorageBlobContainerUri":null}, [ 'server', + .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599781020,"endTime":null,"jobId":"f2b89f8950d44e45aefc036e4539028b","azureStorageBlobContainerUri":null}, [ 'server', 'Kestrel', 'date', - 'Thu, 10 Sep 2020 21:11:16 GMT', + 'Thu, 10 Sep 2020 23:37:00 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm.azure.net/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending', + 'https://eastus2.keyvault_name.managedhsm.azure.net/backup/f2b89f8950d44e45aefc036e4539028b/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', '10', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -54,7 +54,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '890', + '829', 'content-length', '216', 'strict-transport-security', @@ -63,14 +63,14 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') + .get('/backup/f2b89f8950d44e45aefc036e4539028b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"f2b89f8950d44e45aefc036e4539028b","startTime":1599781020,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:16 GMT', + 'Thu, 10 Sep 2020 23:37:01 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -78,7 +78,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -90,19 +90,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '680', + '560', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') + .get('/backup/f2b89f8950d44e45aefc036e4539028b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"f2b89f8950d44e45aefc036e4539028b","startTime":1599781020,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:17 GMT', + 'Thu, 10 Sep 2020 23:37:01 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -110,7 +110,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -122,19 +122,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '625', + '512', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') + .get('/backup/f2b89f8950d44e45aefc036e4539028b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"f2b89f8950d44e45aefc036e4539028b","startTime":1599781020,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:19 GMT', + 'Thu, 10 Sep 2020 23:37:03 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -142,7 +142,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -154,19 +154,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '631', + '525', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') + .get('/backup/f2b89f8950d44e45aefc036e4539028b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"f2b89f8950d44e45aefc036e4539028b","startTime":1599781020,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:22 GMT', + 'Thu, 10 Sep 2020 23:37:06 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -174,7 +174,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -186,19 +186,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '645', + '563', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') + .get('/backup/f2b89f8950d44e45aefc036e4539028b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"f2b89f8950d44e45aefc036e4539028b","startTime":1599781020,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:25 GMT', + 'Thu, 10 Sep 2020 23:37:09 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -206,7 +206,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -218,19 +218,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '645', + '548', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/1b59c3149b4a49368d1b7e8cbbb48312/pending') + .get('/backup/f2b89f8950d44e45aefc036e4539028b/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091021111625","endTime":1599772286,"error":null,"jobId":"1b59c3149b4a49368d1b7e8cbbb48312","startTime":1599772276,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091023370040","endTime":1599781031,"error":null,"jobId":"f2b89f8950d44e45aefc036e4539028b","startTime":1599781020,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:28 GMT', + 'Thu, 10 Sep 2020 23:37:11 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -238,7 +238,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -250,53 +250,245 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '610', + '528', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folderToRestore":"backup"}) + .put('/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folderToRestore":"mhsm-keyvault_name-2020091023370040"}) .query(true) - .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"bfa3388fabdb41b691170ab489da8cb2","startTime":1599772289,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"89317af12e784adb89a1176762b907dd","startTime":1599781032,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'date', - 'Thu, 10 Sep 2020 21:11:28 GMT', + 'Thu, 10 Sep 2020 23:37:12 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm.azure.net/restore/bfa3388fabdb41b691170ab489da8cb2/pending', + 'https://eastus2.keyvault_name.managedhsm.azure.net/restore/89317af12e784adb89a1176762b907dd/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', '10', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '817', + 'content-length', + '180', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/restore/89317af12e784adb89a1176762b907dd/pending') + .query(true) + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"89317af12e784adb89a1176762b907dd","startTime":1599781032,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Thu, 10 Sep 2020 23:37:12 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '180', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '569', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/restore/89317af12e784adb89a1176762b907dd/pending') + .query(true) + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"89317af12e784adb89a1176762b907dd","startTime":1599781032,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Thu, 10 Sep 2020 23:37:13 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', 'SAMEORIGIN', + 'content-length', + '180', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '805', + '521', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/restore/89317af12e784adb89a1176762b907dd/pending') + .query(true) + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"89317af12e784adb89a1176762b907dd","startTime":1599781032,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Thu, 10 Sep 2020 23:37:16 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', 'content-length', '180', 'strict-transport-security', 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '562', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/restore/89317af12e784adb89a1176762b907dd/pending') + .query(true) + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"89317af12e784adb89a1176762b907dd","startTime":1599781032,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Thu, 10 Sep 2020 23:37:19 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '180', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '503', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/restore/89317af12e784adb89a1176762b907dd/pending') + .query(true) + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"89317af12e784adb89a1176762b907dd","startTime":1599781032,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Thu, 10 Sep 2020 23:37:21 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '180', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '603', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/restore/89317af12e784adb89a1176762b907dd/pending') + .query(true) + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"89317af12e784adb89a1176762b907dd","startTime":1599781032,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Thu, 10 Sep 2020 23:37:24 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '180', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '525', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/bfa3388fabdb41b691170ab489da8cb2/pending') + .get('/restore/89317af12e784adb89a1176762b907dd/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/backup","endTime":1599772289,"error":{"code":null,"innererror":null,"message":null},"jobId":"bfa3388fabdb41b691170ab489da8cb2","startTime":1599772289,"status":"Failed","statusDetails":"Invalid backup provided"}, [ 'server', + .reply(200, {"endTime":1599781044,"error":null,"jobId":"89317af12e784adb89a1176762b907dd","startTime":1599781032,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:29 GMT', + 'Thu, 10 Sep 2020 23:37:26 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -304,18 +496,18 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', 'SAMEORIGIN', 'content-length', - '291', + '143', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '665', + '538', 'content-security-policy', 'default-src \'self\'' ]); diff --git a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js index ed6c9285afc7..eedc06d53487 100644 --- a/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js +++ b/sdk/keyvault/keyvault-admin/recordings/node/keyvaultbackupclient/recording_beginbackup_then_beginselectiverestore.js @@ -1,16 +1,16 @@ let nock = require('nock'); -module.exports.hash = "e010f163c077c8a3e782ae2b4b5991d1"; +module.exports.hash = "1741f9883764e3713bc64f6dc321f389"; module.exports.testInfo = {"uniqueName":{},"newDate":{}} nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .post('/keys/beginBackupthenbeginSelectiveRestore/create') + .post('/backup') .query(true) .reply(401, "", [ 'content-type', 'application/json; charset=utf-8', 'x-ms-server-latency', - '2', + '1', 'x-content-type-options', 'nosniff', 'www-authenticate', @@ -29,98 +29,80 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'no-cache' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .post('/keys/beginBackupthenbeginSelectiveRestore/create', {"kty":"RSA"}) + .post('/backup', {"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) .query(true) - .reply(200, {"attributes":{"created":1599772302,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599772302},"key":{"e":"AQAB","key_ops":["wrapKey","decrypt","encrypt","unwrapKey","sign","verify"],"kid":"https://eastus2.keyvault_name.managedhsm.azure.net/keys/beginBackupthenbeginSelectiveRestore/103dbfbac8a601bc9ee20f7dcb35535a","kty":"RSA-HSM","n":"vK0p6QSHXodfOhTvPTkXUvkt8Gn4fLlMFMIkF7K3GpBhEZfuS_nAmHWs_jRD7kgL25X9ycjJE-OrBdKjmRvmHnezwE0jU4vEIf15NMY3UbQSnLjfmYDnjipgTyuLpU3x0FyxjwwZCewEgyJ-LFj2UqOCZSWbsVBSDpZOSz-aPmXGR7eJTpLM-dvNfkL6y488-SmBu0tslfRs9E73v4lOhsCSqLfEqMOMpHWvCgQ9kUqw9P5NHwFI52eesNe-XwF_N-XpiQqPeh1DgDfIBDpUHlEtFZUj_qJjSDoIbnO-tkK-dOYdVn4Uycju-i64p-6XdYSHljjylWHKQ1eRIdZU4Q"}}, [ 'content-type', - 'application/json; charset=utf-8', + .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599782936,"endTime":null,"jobId":"031503ecfab448b89844985614a319f9","azureStorageBlobContainerUri":null}, [ 'server', + 'Kestrel', + 'date', + 'Fri, 11 Sep 2020 00:08:56 GMT', + 'cache-control', + 'no-cache', 'x-content-type-options', 'nosniff', - 'content-length', - '755', - 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'azure-asyncoperation', + 'https://eastus2.keyvault_name.managedhsm.azure.net/backup/031503ecfab448b89844985614a319f9/pending', 'x-ms-keyvault-region', 'EASTUS', - 'strict-transport-security', - 'max-age=31536000; includeSubDomains', - 'content-security-policy', - 'default-src \'self\'', - 'x-ms-keyvault-network-info', - 'addr=108.226.109.105', - 'x-ms-server-latency', - '675', - 'cache-control', - 'no-cache', - 'x-frame-options', - 'SAMEORIGIN' ]); - -nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .post('/backup') - .query(true) - .reply(401, "", [ 'content-type', + 'retry-after', + '10', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', 'application/json; charset=utf-8', - 'x-ms-server-latency', - '1', - 'x-content-type-options', - 'nosniff', - 'www-authenticate', - 'Bearer authorization="https://login.windows-ppe.net/azure_tenant_id", resource="https://managedhsm-int.azure-int.net"', 'x-frame-options', 'SAMEORIGIN', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '755', 'content-length', - '0', - 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '216', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'content-security-policy', - 'default-src \'self\'', - 'cache-control', - 'no-cache' ]); + 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .post('/backup', {"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"}) + .get('/backup/031503ecfab448b89844985614a319f9/pending') .query(true) - .reply(202, {"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599772315,"endTime":null,"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","azureStorageBlobContainerUri":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"031503ecfab448b89844985614a319f9","startTime":1599782936,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:54 GMT', + 'Fri, 11 Sep 2020 00:08:57 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', - 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm.azure.net/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending', 'x-ms-keyvault-region', 'EASTUS', - 'retry-after', - '10', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', 'SAMEORIGIN', - 'x-ms-keyvault-network-info', - 'addr=108.226.109.105', - 'x-ms-server-latency', - '900', 'content-length', '216', 'strict-transport-security', 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '505', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') + .get('/backup/031503ecfab448b89844985614a319f9/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"031503ecfab448b89844985614a319f9","startTime":1599782936,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:55 GMT', + 'Fri, 11 Sep 2020 00:08:58 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -128,7 +110,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -140,19 +122,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '600', + '528', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') + .get('/backup/031503ecfab448b89844985614a319f9/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"031503ecfab448b89844985614a319f9","startTime":1599782936,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:56 GMT', + 'Fri, 11 Sep 2020 00:09:00 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -160,7 +142,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -172,19 +154,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '673', + '541', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') + .get('/backup/031503ecfab448b89844985614a319f9/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"031503ecfab448b89844985614a319f9","startTime":1599782936,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:11:58 GMT', + 'Fri, 11 Sep 2020 00:09:03 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -192,7 +174,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -204,19 +186,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '617', + '521', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') + .get('/backup/031503ecfab448b89844985614a319f9/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"031503ecfab448b89844985614a319f9","startTime":1599782936,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:12:01 GMT', + 'Fri, 11 Sep 2020 00:09:05 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -224,7 +206,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -236,19 +218,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '658', + '549', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') + .get('/backup/031503ecfab448b89844985614a319f9/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":null,"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"031503ecfab448b89844985614a319f9","startTime":1599782936,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:12:04 GMT', + 'Fri, 11 Sep 2020 00:09:08 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -256,7 +238,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -268,19 +250,19 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '633', + '574', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/40f784f0d15246c8bd259ce6e2bdc69b/pending') + .get('/backup/031503ecfab448b89844985614a319f9/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091021115530","endTime":1599772325,"error":null,"jobId":"40f784f0d15246c8bd259ce6e2bdc69b","startTime":1599772315,"status":"Succeeded","statusDetails":null}, [ 'server', + .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/mhsm-keyvault_name-2020091100085704","endTime":1599782949,"error":null,"jobId":"031503ecfab448b89844985614a319f9","startTime":1599782936,"status":"Succeeded","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:12:06 GMT', + 'Fri, 11 Sep 2020 00:09:10 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -288,7 +270,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -300,29 +282,29 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '650', + '541', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .put('/keys/beginBackupthenbeginSelectiveRestore/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folder":"backup"}) + .put('/keys/rsa-1/restore', {"sasTokenParameters":{"storageResourceUri":"https://uri.blob.core.windows.net/backup","token":"blob_storage_sas_token"},"folder":"mhsm-keyvault_name-2020091100085704"}) .query(true) - .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"38c9569672334ec8b5b752b9235fe864","startTime":1599772328,"status":"InProgress","statusDetails":null}, [ 'server', + .reply(202, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"84150e9335a94e2eb4493789a5c82473","startTime":1599782951,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'date', - 'Thu, 10 Sep 2020 21:12:07 GMT', + 'Fri, 11 Sep 2020 00:09:11 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', 'azure-asyncoperation', - 'https://eastus2.keyvault_name.managedhsm.azure.net/restore/38c9569672334ec8b5b752b9235fe864/pending', + 'https://eastus2.keyvault_name.managedhsm.azure.net/restore/84150e9335a94e2eb4493789a5c82473/pending', 'x-ms-keyvault-region', 'EASTUS', 'retry-after', '10', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', @@ -330,7 +312,7 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '826', + '796', 'content-length', '180', 'strict-transport-security', @@ -339,14 +321,14 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/backup/38c9569672334ec8b5b752b9235fe864/pending') + .get('/restore/84150e9335a94e2eb4493789a5c82473/pending') .query(true) - .reply(200, {"azureStorageBlobContainerUri":"https://uri.blob.core.windows.net/backup/backup","endTime":1599772328,"error":{"code":null,"innererror":null,"message":null},"jobId":"38c9569672334ec8b5b752b9235fe864","startTime":1599772328,"status":"Failed","statusDetails":"Invalid backup provided"}, [ 'server', + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"84150e9335a94e2eb4493789a5c82473","startTime":1599782951,"status":"InProgress","statusDetails":null}, [ 'server', 'Kestrel', 'x-ms-build-version', '1.0.20200909-2-c73be597-develop', 'date', - 'Thu, 10 Sep 2020 21:12:08 GMT', + 'Fri, 11 Sep 2020 00:09:12 GMT', 'cache-control', 'no-cache', 'x-content-type-options', @@ -354,98 +336,210 @@ nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryPar 'x-ms-keyvault-region', 'EASTUS', 'x-ms-request-id', - '9cd5d3a8-f2aa-11ea-ae7c-0242ac120003', + '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', 'x-frame-options', 'SAMEORIGIN', 'content-length', - '291', + '180', 'strict-transport-security', 'max-age=31536000; includeSubDomains', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '632', + '615', 'content-security-policy', 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .delete('/keys/beginBackupthenbeginSelectiveRestore') + .get('/restore/84150e9335a94e2eb4493789a5c82473/pending') .query(true) - .reply(200, {"attributes":{"created":1599772302,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599772302},"deletedDate":1599772329,"key":{"e":"AQAB","key_ops":["wrapKey","verify","sign","unwrapKey","decrypt","encrypt"],"kid":"https://eastus2.keyvault_name.managedhsm.azure.net/keys/beginBackupthenbeginSelectiveRestore/103dbfbac8a601bc9ee20f7dcb35535a","kty":"RSA-HSM","n":"vK0p6QSHXodfOhTvPTkXUvkt8Gn4fLlMFMIkF7K3GpBhEZfuS_nAmHWs_jRD7kgL25X9ycjJE-OrBdKjmRvmHnezwE0jU4vEIf15NMY3UbQSnLjfmYDnjipgTyuLpU3x0FyxjwwZCewEgyJ-LFj2UqOCZSWbsVBSDpZOSz-aPmXGR7eJTpLM-dvNfkL6y488-SmBu0tslfRs9E73v4lOhsCSqLfEqMOMpHWvCgQ9kUqw9P5NHwFI52eesNe-XwF_N-XpiQqPeh1DgDfIBDpUHlEtFZUj_qJjSDoIbnO-tkK-dOYdVn4Uycju-i64p-6XdYSHljjylWHKQ1eRIdZU4Q"},"recoveryId":"https://eastus2.keyvault_name.managedhsm.azure.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1600377129}, [ 'content-type', - 'application/json; charset=utf-8', + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"84150e9335a94e2eb4493789a5c82473","startTime":1599782951,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Fri, 11 Sep 2020 00:09:12 GMT', + 'cache-control', + 'no-cache', 'x-content-type-options', 'nosniff', - 'content-length', - '932', - 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', 'x-ms-keyvault-region', 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '180', 'strict-transport-security', 'max-age=31536000; includeSubDomains', - 'content-security-policy', - 'default-src \'self\'', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '463', + '539', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/restore/84150e9335a94e2eb4493789a5c82473/pending') + .query(true) + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"84150e9335a94e2eb4493789a5c82473","startTime":1599782951,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Fri, 11 Sep 2020 00:09:15 GMT', 'cache-control', 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', 'x-frame-options', - 'SAMEORIGIN' ]); + 'SAMEORIGIN', + 'content-length', + '180', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '580', + 'content-security-policy', + 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .get('/deletedkeys/beginBackupthenbeginSelectiveRestore') + .get('/restore/84150e9335a94e2eb4493789a5c82473/pending') .query(true) - .reply(200, {"attributes":{"created":1599772302,"enabled":true,"exportable":false,"recoverableDays":7,"recoveryLevel":"CustomizedRecoverable+Purgeable","updated":1599772302},"deletedDate":1599772329,"key":{"e":"AQAB","key_ops":["encrypt","decrypt","unwrapKey","sign","verify","wrapKey"],"kid":"https://eastus2.keyvault_name.managedhsm.azure.net/keys/beginBackupthenbeginSelectiveRestore/103dbfbac8a601bc9ee20f7dcb35535a","kty":"RSA-HSM","n":"vK0p6QSHXodfOhTvPTkXUvkt8Gn4fLlMFMIkF7K3GpBhEZfuS_nAmHWs_jRD7kgL25X9ycjJE-OrBdKjmRvmHnezwE0jU4vEIf15NMY3UbQSnLjfmYDnjipgTyuLpU3x0FyxjwwZCewEgyJ-LFj2UqOCZSWbsVBSDpZOSz-aPmXGR7eJTpLM-dvNfkL6y488-SmBu0tslfRs9E73v4lOhsCSqLfEqMOMpHWvCgQ9kUqw9P5NHwFI52eesNe-XwF_N-XpiQqPeh1DgDfIBDpUHlEtFZUj_qJjSDoIbnO-tkK-dOYdVn4Uycju-i64p-6XdYSHljjylWHKQ1eRIdZU4Q"},"recoveryId":"https://eastus2.keyvault_name.managedhsm.azure.net/deletedkeys/beginBackupthenbeginSelectiveRestore","scheduledPurgeDate":1600377129}, [ 'x-frame-options', - 'SAMEORIGIN', + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"84150e9335a94e2eb4493789a5c82473","startTime":1599782951,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Fri, 11 Sep 2020 00:09:18 GMT', + 'cache-control', + 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', 'x-ms-request-id', '58dd65a2-f2a6-11ea-a492-0242ac120009', 'content-type', 'application/json; charset=utf-8', - 'x-ms-keyvault-region', - 'EASTUS', + 'x-frame-options', + 'SAMEORIGIN', 'content-length', - '932', + '180', 'strict-transport-security', 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '554', 'content-security-policy', - 'default-src \'self\'', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/restore/84150e9335a94e2eb4493789a5c82473/pending') + .query(true) + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"84150e9335a94e2eb4493789a5c82473","startTime":1599782951,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Fri, 11 Sep 2020 00:09:20 GMT', 'cache-control', 'no-cache', 'x-content-type-options', 'nosniff', - 'x-ms-build-version', - '1.0.20200909-2-c73be597-develop', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '180', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '175' ]); + '565', + 'content-security-policy', + 'default-src \'self\'' ]); nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) - .delete('/deletedkeys/beginBackupthenbeginSelectiveRestore') + .get('/restore/84150e9335a94e2eb4493789a5c82473/pending') .query(true) - .reply(204, "", [ 'content-type', - 'application/json; charset=utf-8', + .reply(200, {"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"84150e9335a94e2eb4493789a5c82473","startTime":1599782951,"status":"InProgress","statusDetails":null}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Fri, 11 Sep 2020 00:09:22 GMT', + 'cache-control', + 'no-cache', 'x-content-type-options', 'nosniff', - 'content-length', - '0', - 'x-ms-request-id', - '58dd65a2-f2a6-11ea-a492-0242ac120009', 'x-ms-keyvault-region', 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', + 'x-frame-options', + 'SAMEORIGIN', + 'content-length', + '180', 'strict-transport-security', 'max-age=31536000; includeSubDomains', - 'content-security-policy', - 'default-src \'self\'', 'x-ms-keyvault-network-info', 'addr=108.226.109.105', 'x-ms-server-latency', - '529', + '522', + 'content-security-policy', + 'default-src \'self\'' ]); + +nock('https://eastus2.keyvault_name.managedhsm.azure.net:443', {"encodedQueryParams":true}) + .get('/restore/84150e9335a94e2eb4493789a5c82473/pending') + .query(true) + .reply(200, {"endTime":1599782964,"error":null,"jobId":"84150e9335a94e2eb4493789a5c82473","startTime":1599782951,"status":"Succeeded","statusDetails":"Number of successful key versions restored: 0, Number of key versions could not overwrite: 4"}, [ 'server', + 'Kestrel', + 'x-ms-build-version', + '1.0.20200909-2-c73be597-develop', + 'date', + 'Fri, 11 Sep 2020 00:09:25 GMT', 'cache-control', 'no-cache', + 'x-content-type-options', + 'nosniff', + 'x-ms-keyvault-region', + 'EASTUS', + 'x-ms-request-id', + '58dd65a2-f2a6-11ea-a492-0242ac120009', + 'content-type', + 'application/json; charset=utf-8', 'x-frame-options', - 'SAMEORIGIN' ]); + 'SAMEORIGIN', + 'content-length', + '233', + 'strict-transport-security', + 'max-age=31536000; includeSubDomains', + 'x-ms-keyvault-network-info', + 'addr=108.226.109.105', + 'x-ms-server-latency', + '528', + 'content-security-policy', + 'default-src \'self\'' ]); diff --git a/sdk/keyvault/keyvault-admin/src/backupClient.ts b/sdk/keyvault/keyvault-admin/src/backupClient.ts index bacd3cd98b61..94ee65b2185c 100644 --- a/sdk/keyvault/keyvault-admin/src/backupClient.ts +++ b/sdk/keyvault/keyvault-admin/src/backupClient.ts @@ -194,7 +194,7 @@ export class KeyVaultBackupClient { * @summary Starts a full restore operation. * @param blobStorageUri The URL of the blob storage resource where the previous successful full backup was stored. * @param sasToken The SAS token. - * @param folderName The folder name of the blob where the previous successful full backup was stored. + * @param folderName The folder name of the blob where the previous successful full backup was stored. The URL segment after the container name. * @param [options] The optional parameters. */ public async beginRestore( @@ -257,7 +257,7 @@ export class KeyVaultBackupClient { * @summary Creates a new role assignment. * @param blobStorageUri The URL of the blob storage resource, with the folder name of the blob where the previous successful full backup was stored. * @param sasToken The SAS token. - * @param folderName The Folder name of the blob where the previous successful full backup was stored. + * @param folderName The Folder name of the blob where the previous successful full backup was stored. The URL segment after the container name. * @param keyName The name of the key that wants to be restored. * @param [options] The optional parameters. */ diff --git a/sdk/keyvault/keyvault-admin/src/lro/restore/operation.ts b/sdk/keyvault/keyvault-admin/src/lro/restore/operation.ts index 8a55182f8e14..7c02471fcdae 100644 --- a/sdk/keyvault/keyvault-admin/src/lro/restore/operation.ts +++ b/sdk/keyvault/keyvault-admin/src/lro/restore/operation.ts @@ -6,8 +6,8 @@ import { PollOperationState, PollOperation } from "@azure/core-lro"; import { OperationOptions, RequestOptionsBase } from "@azure/core-http"; import { KeyVaultClient } from "../../generated/keyVaultClient"; import { - KeyVaultClientFullBackupStatusResponse, - KeyVaultClientFullRestoreOperationOptionalParams + KeyVaultClientFullRestoreOperationOptionalParams, + KeyVaultClientRestoreStatusResponse } from "../../generated/models"; import { createSpan, setParentSpan } from "../../tracing"; import { KeyVaultClientFullRestoreOperationResponse } from "../../generated/models"; @@ -111,17 +111,17 @@ async function fullRestore( } /** - * Tracing the fullRestoreStatus operation. + * Tracing the restoreStatus operation. */ -async function fullBackupStatus( +async function restoreStatus( client: KeyVaultClient, vaultUrl: string, jobId: string, options: OperationOptions -): Promise { - const span = createSpan("generatedClient.fullBackupStatus", options); +): Promise { + const span = createSpan("generatedClient.restoreStatus", options); try { - return await client.fullBackupStatus(vaultUrl, jobId, setParentSpan(span, options)); + return await client.restoreStatus(vaultUrl, jobId, setParentSpan(span, options)); } finally { span.end(); } @@ -188,7 +188,7 @@ async function update( } if (!state.isCompleted) { - const serviceOperation = await fullBackupStatus(client, vaultUrl, state.jobId, { + const serviceOperation = await restoreStatus(client, vaultUrl, state.jobId, { requestOptions }); const { endTime, status, statusDetails, error } = serviceOperation; diff --git a/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts b/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts index 879619c48de2..fdd7cc87c9ad 100644 --- a/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts +++ b/sdk/keyvault/keyvault-admin/src/lro/selectiveRestore/operation.ts @@ -10,7 +10,7 @@ import { } from "@azure/core-http"; import { KeyVaultClient } from "../../generated/keyVaultClient"; import { - KeyVaultClientFullBackupStatusResponse, + KeyVaultClientRestoreStatusResponse, KeyVaultClientSelectiveKeyRestoreOperationOptionalParams, KeyVaultClientSelectiveKeyRestoreOperationResponse } from "../../generated/models"; @@ -126,18 +126,18 @@ async function selectiveRestore( } /** - * Tracing the fullRestoreStatus operation. + * Tracing the restoreStatus operation. */ -async function fullRestoreStatus( +async function restoreStatus( client: KeyVaultClient, vaultUrl: string, jobId: string, options: OperationOptions -): Promise { +): Promise { const requestOptions = operationOptionsToRequestOptionsBase(options); - const span = createSpan("generatedClient.fullRestoreStatus", requestOptions); + const span = createSpan("generatedClient.restoreStatus", requestOptions); try { - return await client.fullBackupStatus(vaultUrl, jobId, options); + return await client.restoreStatus(vaultUrl, jobId, options); } finally { span.end(); } @@ -209,7 +209,7 @@ async function update( } if (!state.isCompleted) { - const selectiveRestoreOperation = await fullRestoreStatus(client, vaultUrl, state.jobId, { + const selectiveRestoreOperation = await restoreStatus(client, vaultUrl, state.jobId, { requestOptions }); const { endTime, status, statusDetails, error } = selectiveRestoreOperation; diff --git a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts index c67d80c1f8e6..dff1998ccafc 100644 --- a/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/accessControlClient.spec.ts @@ -107,9 +107,9 @@ describe("KeyVaultAccessControlClient", () => { let error: Error; try { await client.getRoleAssignment(globalScope, name); - } catch(e) { + } catch (e) { error = e; } - assert.ok(error!.message.match(/Requested role assignment not found/)) + assert.ok(error!.message.match(/Requested role assignment not found/)); }); }); diff --git a/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts b/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts index c017b8bd4df4..2073a6f677ea 100644 --- a/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/backupClient.abort.spec.ts @@ -12,11 +12,13 @@ import { assertThrowsAbortError, getFolderName } from "../utils/common"; describe("Aborting KeyVaultBackupClient's requests", () => { let client: KeyVaultBackupClient; let recorder: Recorder; + let generateFakeUUID: () => string; beforeEach(async function() { const authentication = await authenticate(this); client = authentication.backupClient; recorder = authentication.recorder; + generateFakeUUID = authentication.generateFakeUUID; }); afterEach(async function() { @@ -42,8 +44,9 @@ describe("Aborting KeyVaultBackupClient's requests", () => { it("can abort beginRestore", async function() { const blobStorageUri = env.BLOB_STORAGE_URI; + const backupURI = `${blobStorageUri}/${generateFakeUUID()}`; const sasToken = env.BLOB_STORAGE_SAS_TOKEN; - const folderName = getFolderName(blobStorageUri); + const folderName = getFolderName(backupURI); const controller = new AbortController(); controller.abort(); @@ -58,8 +61,9 @@ describe("Aborting KeyVaultBackupClient's requests", () => { it("can abort beginSelectiveRestore", async function() { const blobStorageUri = env.BLOB_STORAGE_URI; + const backupURI = `${blobStorageUri}/${generateFakeUUID()}`; const sasToken = env.BLOB_STORAGE_SAS_TOKEN; - const folderName = getFolderName(blobStorageUri); + const folderName = getFolderName(backupURI); const controller = new AbortController(); controller.abort(); diff --git a/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts index 40c2665fe37c..feeb28406f8f 100644 --- a/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts +++ b/sdk/keyvault/keyvault-admin/test/public/backupClient.spec.ts @@ -3,22 +3,19 @@ import { assert } from "chai"; import { env, Recorder } from "@azure/test-utils-recorder"; -import { KeyClient } from "@azure/keyvault-keys"; import { KeyVaultBackupClient } from "../../src"; import { authenticate } from "../utils/authentication"; import { testPollerProperties } from "../utils/recorder"; -import { formatName, getFolderName } from "../utils/common"; +import { getFolderName } from "../utils/common"; describe("KeyVaultBackupClient", () => { let client: KeyVaultBackupClient; - let keyClient: KeyClient; let recorder: Recorder; beforeEach(async function() { const authentication = await authenticate(this); client = authentication.backupClient; - keyClient = authentication.keyClient; recorder = authentication.recorder; }); @@ -57,9 +54,7 @@ describe("KeyVaultBackupClient", () => { }); it("beginBackup, then beginSelectiveRestore", async function() { - const keyName = formatName(this!.test!.title); - const key = await keyClient.createRsaKey(keyName); - assert.equal(key.name, keyName, "Unexpected key name in result from createRsaKey()."); + const keyName = "rsa-1"; const blobStorageUri = env.BLOB_STORAGE_URI; const sasToken = env.BLOB_STORAGE_SAS_TOKEN; @@ -72,16 +67,12 @@ describe("KeyVaultBackupClient", () => { blobStorageUri, sasToken, folderName, - key.name, + keyName, testPollerProperties ); await selectiveRestorePoller.pollUntilDone(); const operationState = selectiveRestorePoller.getOperationState(); assert.equal(operationState.isCompleted, true); assert.equal(operationState.error, undefined); - - const deleteKeyPoller = await keyClient.beginDeleteKey(keyName); - await deleteKeyPoller.pollUntilDone(); - await keyClient.purgeDeletedKey(keyName); }); }); diff --git a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts index c085f51ed3bb..1674d5d4fca8 100644 --- a/sdk/keyvault/keyvault-admin/test/utils/authentication.ts +++ b/sdk/keyvault/keyvault-admin/test/utils/authentication.ts @@ -2,7 +2,6 @@ // Licensed under the MIT license. import { AzureCliCredential } from "@azure/identity"; -import { KeyClient } from "@azure/keyvault-keys"; import { isPlaybackMode, record, RecorderEnvironmentSetup } from "@azure/test-utils-recorder"; import { v4 as uuidv4 } from "uuid"; @@ -21,7 +20,7 @@ export async function authenticate(that: any): Promise { return uuid; } - const secretSuffix = uniqueString(); + const suffix = uniqueString(); const recorderEnvSetup: RecorderEnvironmentSetup = { replaceableVariables: { AZURE_CLIENT_ID: "azure_client_id", @@ -37,7 +36,7 @@ export async function authenticate(that: any): Promise { (recording: any): any => recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`), (recording: any): any => - secretSuffix === "" ? recording : recording.replace(new RegExp(secretSuffix, "g"), ""), + suffix === "" ? recording : recording.replace(new RegExp(suffix, "g"), ""), (recording: any): any => recording.replace( /keyvault_name\.[a-z-]+\.azure[a-z-]*\.net/g, @@ -62,7 +61,6 @@ export async function authenticate(that: any): Promise { const keyVaultUrl = getKeyVaultUrl() || `https://${keyVaultName}.vault.azure.net`; const accessControlClient = new KeyVaultAccessControlClient(keyVaultUrl, credential); const backupClient = new KeyVaultBackupClient(keyVaultUrl, credential); - const keyClient = new KeyClient(keyVaultUrl, credential); - return { recorder, accessControlClient, backupClient, keyClient, secretSuffix, generateFakeUUID }; + return { recorder, accessControlClient, backupClient, suffix, generateFakeUUID }; } diff --git a/sdk/keyvault/keyvault-admin/test/utils/common.ts b/sdk/keyvault/keyvault-admin/test/utils/common.ts index cc8136708bf7..fe10995cac2b 100644 --- a/sdk/keyvault/keyvault-admin/test/utils/common.ts +++ b/sdk/keyvault/keyvault-admin/test/utils/common.ts @@ -51,7 +51,9 @@ export function formatName(name: string): string { // Receives: // https://uri.blob.core.windows.net/backup/ // Splits into: -// https: uri.blob.core.windows.net backup +// ["https:", "", "uri.blob.core.windows.net", "backup", ""] +// Returns: +// "" export function getFolderName(uri: string): string { - return uri.split("/")[3]; + return uri.split("/")[4]; }