Skip to content

Commit

Permalink
Add examples to readme (#22809)
Browse files Browse the repository at this point in the history
Co-authored-by: andrew <andrsmith@microsoft.com>
  • Loading branch information
The-DevBlog and andrsmith149 authored Aug 15, 2022
1 parent 4d30cf8 commit 88c0701
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions sdk/automanage/arm-automanage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,76 @@ const client = new AutomanageClient(new DefaultAzureCredential(), subscriptionId
// const client = new AutomanageClient(credential, subscriptionId);
```

## Examples

#### Create or Update Configuration Profile

To update a file, simply replace any of the values within the **properties** and run the **createOrUpdate()** function again.

```javascript
const newProfile = {
"location": "eastus",
"tags": {
"environment": "prod"
},
"properties": {
"configuration": {
"Antimalware/Enable": true,
"Antimalware/EnableRealTimeProtection": true,
"Antimalware/RunScheduledScan": true,
"Antimalware/ScanType": "Quick",
"Antimalware/ScanDay": 7,
"Antimalware/ScanTimeInMinutes": 120,
"Backup/Enable": true,
"Backup/PolicyName": "dailyBackupPolicy",
"Backup/TimeZone": "UTC",
"Backup/InstantRpRetentionRangeInDays": 2,
"Backup/SchedulePolicy/ScheduleRunFrequency": "Daily",
"Backup/SchedulePolicy/SchedulePolicyType": "SimpleSchedulePolicy",
"Backup/RetentionPolicy/RetentionPolicyType": "LongTermRetentionPolicy",
"Backup/RetentionPolicy/DailySchedule/RetentionDuration/Count": 180,
"Backup/RetentionPolicy/DailySchedule/RetentionDuration/DurationType": "Days",
"WindowsAdminCenter/Enable": false,
"VMInsights/Enable": true,
"AzureSecurityCenter/Enable": true,
"UpdateManagement/Enable": true,
"ChangeTrackingAndInventory/Enable": true,
"GuestConfiguration/Enable": true,
"AutomationAccount/Enable": true,
"LogAnalytics/Enable": true,
"BootDiagnostics/Enable": true
}
}
}

await client.configurationProfiles.createOrUpdate("configurationProfileName", "resourceGroupName", newProfile);
```

#### Delete Configuration Profile
```javascript
await client.configurationProfiles.delete("resourceGroupName", "configurationProfileName");
```
#### Create Best Practices Production Profile Assignment
```javascript
let assignment = {
"properties": {
"configurationProfile": "/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesProduction"
}
}

await client.configurationProfileAssignments.createOrUpdate("default", "resourceGroupName", "vmName", assignment);
```

#### Create Custom Profile Assignment
```javascript
let assignment = {
"properties": {
"configurationProfile": "/subscriptions/<subscription ID>/resourceGroups/resourceGroupName/providers/Microsoft.Automanage/configurationProfiles/configurationProfileName"
}
}

await client.configurationProfileAssignments.createOrUpdate("default", "resourceGroupName", "vmName", assignment);
```

### JavaScript Bundle
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
Expand Down

0 comments on commit 88c0701

Please sign in to comment.