Skip to content

Commit ec8783c

Browse files
author
SDKAuto
committed
CodeGen from PR 14676 in Azure/azure-rest-api-specs
Merge 2f587dc49a8eaf1817241d92ecb6bf406f08a313 into 50eae85eb163a45c70a516cb3ca1225605ca381b
1 parent 3866111 commit ec8783c

File tree

122 files changed

+17986
-2420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+17986
-2420
lines changed

sdk/security/arm-security/LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2020 Microsoft
3+
Copyright (c) 2021 Microsoft
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

sdk/security/arm-security/README.md

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,99 @@
11
## Azure SecurityCenter SDK for JavaScript
22

3-
This package contains an isomorphic SDK for SecurityCenter.
3+
This package contains an isomorphic SDK (runs both in node.js and in browsers) for SecurityCenter.
44

55
### Currently supported environments
66

7-
- Node.js version 6.x.x or higher
7+
- Node.js version 8.x.x or higher
88
- Browser JavaScript
99

10-
### How to Install
10+
### Prerequisites
1111

12+
You must have an [Azure subscription](https://azure.microsoft.com/free/).
13+
14+
### How to install
15+
16+
To use this SDK in your project, you will need to install two packages.
17+
- `@azure/arm-security` that contains the client.
18+
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
19+
20+
Install both packages using the below command:
1221
```bash
13-
npm install @azure/arm-security
22+
npm install --save @azure/arm-security @azure/identity
1423
```
24+
> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
25+
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
1526

1627
### How to use
1728

18-
#### nodejs - Authentication, client creation and list complianceResults as an example written in TypeScript.
29+
- If you are writing a client side browser application,
30+
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
31+
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
32+
- If you are writing a server side application,
33+
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
34+
- Complete the set up steps required by the credential if any.
35+
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
1936

20-
##### Install @azure/ms-rest-nodeauth
21-
22-
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
23-
```bash
24-
npm install @azure/ms-rest-nodeauth@"^3.0.0"
25-
```
37+
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
38+
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
39+
#### nodejs - Authentication, client creation, and list complianceResults as an example written in JavaScript.
2640

2741
##### Sample code
2842

29-
```typescript
30-
import * as msRest from "@azure/ms-rest-js";
31-
import * as msRestAzure from "@azure/ms-rest-azure-js";
32-
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
33-
import { SecurityCenter, SecurityCenterModels, SecurityCenterMappers } from "@azure/arm-security";
43+
```javascript
44+
const { DefaultAzureCredential } = require("@azure/identity");
45+
const { SecurityCenter } = require("@azure/arm-security");
3446
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
3547

36-
msRestNodeAuth.interactiveLogin().then((creds) => {
37-
const client = new SecurityCenter(creds, subscriptionId);
38-
const scope = "testscope";
39-
client.complianceResults.list(scope).then((result) => {
40-
console.log("The result is:");
41-
console.log(result);
42-
});
48+
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
49+
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
50+
const creds = new DefaultAzureCredential();
51+
const client = new SecurityCenter(creds, subscriptionId);
52+
const scope = "testscope";
53+
client.complianceResults.list(scope).then((result) => {
54+
console.log("The result is:");
55+
console.log(result);
4356
}).catch((err) => {
57+
console.log("An error occurred:");
4458
console.error(err);
4559
});
4660
```
4761

48-
#### browser - Authentication, client creation and list complianceResults as an example written in JavaScript.
62+
#### browser - Authentication, client creation, and list complianceResults as an example written in JavaScript.
4963

50-
##### Install @azure/ms-rest-browserauth
51-
52-
```bash
53-
npm install @azure/ms-rest-browserauth
54-
```
64+
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
65+
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
66+
- Note down the client Id from the previous step and use it in the browser sample below.
5567

5668
##### Sample code
5769

58-
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
59-
6070
- index.html
71+
6172
```html
6273
<!DOCTYPE html>
6374
<html lang="en">
6475
<head>
6576
<title>@azure/arm-security sample</title>
66-
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
6777
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
68-
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
78+
<script src="node_modules/@azure/identity/dist/index.js"></script>
6979
<script src="node_modules/@azure/arm-security/dist/arm-security.js"></script>
7080
<script type="text/javascript">
7181
const subscriptionId = "<Subscription_Id>";
72-
const authManager = new msAuth.AuthManager({
82+
// Create credentials using the `@azure/identity` package.
83+
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
84+
const credential = new InteractiveBrowserCredential(
85+
{
7386
clientId: "<client id for your Azure AD app>",
7487
tenant: "<optional tenant for your organization>"
7588
});
76-
authManager.finalizeLogin().then((res) => {
77-
if (!res.isLoggedIn) {
78-
// may cause redirects
79-
authManager.login();
80-
}
81-
const client = new Azure.ArmSecurity.SecurityCenter(res.creds, subscriptionId);
82-
const scope = "testscope";
83-
client.complianceResults.list(scope).then((result) => {
84-
console.log("The result is:");
85-
console.log(result);
86-
}).catch((err) => {
87-
console.log("An error occurred:");
88-
console.error(err);
89-
});
89+
const client = new Azure.ArmSecurity.SecurityCenter(creds, subscriptionId);
90+
const scope = "testscope";
91+
client.complianceResults.list(scope).then((result) => {
92+
console.log("The result is:");
93+
console.log(result);
94+
}).catch((err) => {
95+
console.log("An error occurred:");
96+
console.error(err);
9097
});
9198
</script>
9299
</head>

sdk/security/arm-security/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
"description": "SecurityCenter Library with typescript type definitions for node.js and browser.",
55
"version": "2.0.0",
66
"dependencies": {
7-
"@azure/ms-rest-azure-js": "^2.0.1",
8-
"@azure/ms-rest-js": "^2.0.4",
7+
"@azure/ms-rest-azure-js": "^2.1.0",
8+
"@azure/ms-rest-js": "^2.2.0",
9+
"@azure/core-auth": "^1.1.4",
910
"tslib": "^1.10.0"
1011
},
1112
"keywords": [
@@ -20,7 +21,7 @@
2021
"module": "./esm/securityCenter.js",
2122
"types": "./esm/securityCenter.d.ts",
2223
"devDependencies": {
23-
"typescript": "^3.5.3",
24+
"typescript": "^3.6.0",
2425
"rollup": "^1.18.0",
2526
"rollup-plugin-node-resolve": "^5.2.0",
2627
"rollup-plugin-sourcemaps": "^0.4.2",

sdk/security/arm-security/rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const config = {
2121
"@azure/ms-rest-azure-js": "msRestAzure"
2222
},
2323
banner: `/*
24-
* Copyright (c) Microsoft Corporation. All rights reserved.
25-
* Licensed under the MIT License. See License.txt in the project root for license information.
24+
* Copyright (c) Microsoft Corporation.
25+
* Licensed under the MIT License.
2626
*
2727
* Code generated by Microsoft (R) AutoRest Code Generator.
2828
* Changes may cause incorrect behavior and will be lost if the code is regenerated.

sdk/security/arm-security/src/models/adaptiveApplicationControlsMappers.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/*
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
44
*
55
* Code generated by Microsoft (R) AutoRest Code Generator.
66
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
*/
88

99
export {
1010
discriminators,
11-
AppWhitelistingGroup,
12-
AppWhitelistingGroups,
13-
AppWhitelistingIssueSummary,
11+
AdaptiveApplicationControlGroup,
12+
AdaptiveApplicationControlGroups,
13+
AdaptiveApplicationControlIssueSummary,
1414
CloudError,
1515
PathRecommendation,
1616
ProtectionMode,

sdk/security/arm-security/src/models/adaptiveNetworkHardeningsMappers.ts

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
44
*
55
* Code generated by Microsoft (R) AutoRest Code Generator.
66
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
@@ -15,7 +15,6 @@ export {
1515
AdditionalData,
1616
AdvancedThreatProtectionSetting,
1717
Alert,
18-
AlertConfidenceReason,
1918
AlertEntity,
2019
AlertsSuppressionRule,
2120
AllowlistCustomAlertRule,
@@ -25,53 +24,91 @@ export {
2524
AscLocation,
2625
AssessmentLinks,
2726
AssessmentStatus,
27+
AuthenticationDetailsProperties,
2828
AutoProvisioningSetting,
29+
AwAssumeRoleAuthenticationDetailsProperties,
30+
AwsCredsAuthenticationDetailsProperties,
2931
AzureResourceDetails,
32+
AzureResourceIdentifier,
3033
AzureResourceLink,
34+
Baseline,
35+
BaselineAdjustedResult,
3136
BaseResource,
37+
BenchmarkReference,
3238
CloudError,
3339
Compliance,
3440
ComplianceResult,
3541
ComplianceSegment,
42+
ConnectionFromIpNotAllowed,
3643
ConnectionToIpNotAllowed,
44+
ConnectorSetting,
3745
ContainerRegistryVulnerabilityProperties,
3846
CustomAlertRule,
3947
CVE,
4048
CVSS,
4149
DataExportSettings,
4250
DenylistCustomAlertRule,
51+
Device,
4352
DeviceSecurityGroup,
4453
DirectMethodInvokesNotInAllowedRange,
4554
EffectiveNetworkSecurityGroups,
4655
FailedLocalLoginsNotInAllowedRange,
4756
FileUploadsNotInAllowedRange,
57+
Firmware,
58+
GcpCredentialsDetailsProperties,
4859
HttpC2DMessagesNotInAllowedRange,
4960
HttpC2DRejectedMessagesNotInAllowedRange,
5061
HttpD2CMessagesNotInAllowedRange,
62+
HybridComputeSettingsProperties,
5163
InformationProtectionKeyword,
5264
InformationProtectionPolicy,
5365
InformationType,
66+
IngestionSetting,
67+
IotAlertModel,
68+
IotAlertType,
69+
IotDefenderSettingsModel,
70+
IotRecommendationModel,
71+
IotRecommendationType,
5472
IoTSecurityAlertedDevice,
5573
IoTSecurityDeviceAlert,
5674
IoTSecurityDeviceRecommendation,
5775
IoTSecuritySolutionAnalyticsModel,
5876
IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem,
77+
IotSensorsModel,
5978
IoTSeverityMetrics,
79+
IotSitesModel,
80+
IpAddress,
6081
ListCustomAlertRule,
6182
LocalUserNotAllowed,
83+
LogAnalyticsIdentifier,
84+
MacAddress,
6285
MqttC2DMessagesNotInAllowedRange,
6386
MqttC2DRejectedMessagesNotInAllowedRange,
6487
MqttD2CMessagesNotInAllowedRange,
88+
NetworkInterface,
89+
OnPremiseIotSensor,
6590
OnPremiseResourceDetails,
91+
OnPremiseSqlResourceDetails,
6692
Pricing,
6793
ProcessNotAllowed,
94+
Protocol1,
95+
ProxyServerProperties,
96+
QueryCheck,
6897
QueuePurgesNotInAllowedRange,
6998
RegulatoryComplianceAssessment,
7099
RegulatoryComplianceControl,
71100
RegulatoryComplianceStandard,
101+
Remediation,
72102
Resource,
73103
ResourceDetails,
104+
ResourceIdentifier,
74105
Rule,
106+
RuleResults,
107+
RuleResultsProperties,
108+
Scan,
109+
ScanProperties,
110+
ScanResult,
111+
ScanResultProperties,
75112
ScopeElement,
76113
SecureScoreControlDefinitionItem,
77114
SecureScoreControlDefinitionSource,
@@ -87,17 +124,21 @@ export {
87124
SecurityTask,
88125
SecurityTaskParameters,
89126
SensitivityLabel,
127+
Sensor,
90128
ServerVulnerabilityAssessment,
91129
ServerVulnerabilityProperties,
130+
ServicePrincipalProperties,
92131
Setting,
93-
SettingResource,
132+
Site,
133+
Software,
94134
SqlServerVulnerabilityProperties,
95135
SubAssessmentStatus,
96136
SuppressionAlertsScope,
97137
ThresholdCustomAlertRule,
98138
TimeWindowCustomAlertRule,
99139
TwinUpdatesNotInAllowedRange,
100140
UnauthorizedOperationsNotInAllowedRange,
141+
VaRule,
101142
VendorReference,
102143
WorkspaceSetting
103144
} from "../models/mappers";

0 commit comments

Comments
 (0)