UNPKG

@azure/arm-security

Version:
66 lines 3.45 kB
/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { __awaiter } from "tslib"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { SecurityCenter } from "@azure/arm-security"; import { DefaultAzureCredential } from "@azure/identity"; /** * This sample demonstrates how to Add a list of baseline rules. Will overwrite any previously existing results (for all rules). * * @summary Add a list of baseline rules. Will overwrite any previously existing results (for all rules). * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Add.json */ function createABaselineForAllRules() { return __awaiter(this, void 0, void 0, function* () { const subscriptionId = "00000000-0000-0000-0000-000000000000"; const workspaceId = "55555555-6666-7777-8888-999999999999"; const resourceId = "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master"; const body = { latestScan: false, results: { va1234: [ ["userA", "SELECT"], ["userB", "SELECT"] ], va5678: [["Test", "0.0.0.0", "125.125.125.125"]] } }; const options = { body }; const credential = new DefaultAzureCredential(); const client = new SecurityCenter(credential, subscriptionId); const result = yield client.sqlVulnerabilityAssessmentBaselineRules.add(workspaceId, resourceId, options); console.log(result); }); } createABaselineForAllRules().catch(console.error); /** * This sample demonstrates how to Add a list of baseline rules. Will overwrite any previously existing results (for all rules). * * @summary Add a list of baseline rules. Will overwrite any previously existing results (for all rules). * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_AddLatest.json */ function createABaselineForAllRulesUsingTheLatestScanResults() { return __awaiter(this, void 0, void 0, function* () { const subscriptionId = "00000000-0000-0000-0000-000000000000"; const workspaceId = "55555555-6666-7777-8888-999999999999"; const resourceId = "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master"; const body = { latestScan: true, results: {} }; const options = { body }; const credential = new DefaultAzureCredential(); const client = new SecurityCenter(credential, subscriptionId); const result = yield client.sqlVulnerabilityAssessmentBaselineRules.add(workspaceId, resourceId, options); console.log(result); }); } createABaselineForAllRulesUsingTheLatestScanResults().catch(console.error); //# sourceMappingURL=sqlVulnerabilityAssessmentBaselineRulesAddSample.js.map