Skip to content

Commit 51d7f01

Browse files
author
David Curwin
committed
Fix PowerShell commands
1 parent 01703eb commit 51d7f01

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

articles/defender-for-cloud/powershell-onboarding.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22
title: Onboard with PowerShell
33
description: This document walks you through the process of enabling Microsoft Defender for Cloud with PowerShell cmdlets.
44
ms.topic: quickstart
5-
ms.date: 01/24/2023
5+
ms.date: 01/04/2024
66
ms.custom: mode-api, ignite-2022, devx-track-azurepowershell
77
---
88

9-
# Quickstart: Automate onboarding of Microsoft Defender for Cloud using PowerShell
9+
# Automate onboarding of Microsoft Defender for Cloud using PowerShell
1010

1111
You can secure your Azure workloads programmatically, using the Microsoft Defender for Cloud PowerShell module. Using PowerShell enables you to automate tasks and avoid the human error inherent in manual tasks. This is especially useful in large-scale deployments that involve dozens of subscriptions with hundreds and thousands of resources, all of which must be secured from the beginning.
1212

1313
Onboarding Microsoft Defender for Cloud using PowerShell enables you to programmatically automate onboarding and management of your Azure resources and add the necessary security controls.
1414

15-
This article provides a sample PowerShell script that can be modified and used in your environment to roll out Defender for Cloud across your subscriptions.
15+
This article provides a sample PowerShell script that can be modified and used in your environment to roll out Defender for Cloud across your subscriptions.
1616

1717
In this example, we'll enable Defender for Cloud on a subscription with ID: d07c0080-170c-4c24-861d-9c817742786c and apply the recommended settings that provide a high level of protection, by enabling Microsoft Defender for Cloud's enhanced security features, which provides advanced threat protection and detection capabilities:
1818

1919
1. Enable [the enhanced security in Microsoft Defender for Cloud](enable-enhanced-security.md).
20-
21-
2. Set the Log Analytics workspace to which the Log Analytics agent will send the data it collects on the VMs associated with the subscription – in this example, an existing user defined workspace (myWorkspace).
2220

23-
3. Activate Defender for Cloud’s automatic agent provisioning, which [deploys the Log Analytics agent](working-with-log-analytics-agent.md).
21+
1. Set the Log Analytics workspace to which the Log Analytics agent will send the data it collects on the VMs associated with the subscription – in this example, an existing user defined workspace (myWorkspace).
2422

25-
5. Set the organization’s [CISO as the security contact for Defender for Cloud alerts and notable events](configure-email-notifications.md).
23+
1. Activate Defender for Cloud’s automatic agent provisioning, which [deploys the Log Analytics agent](working-with-log-analytics-agent.md).
2624

27-
6. Assign Defender for Cloud’s [default security policies](tutorial-security-policy.md).
25+
1. Set the organization’s [CISO as the security contact for Defender for Cloud alerts and notable events](configure-email-notifications.md).
26+
27+
1. Assign Defender for Cloud’s [default security policies](tutorial-security-policy.md).
2828

2929
## Prerequisites
3030

@@ -33,7 +33,7 @@ These steps should be performed before you run the Defender for Cloud cmdlets:
3333
1. Run PowerShell as admin.
3434

3535
1. Run the following commands in PowerShell:
36-
36+
3737
```powershell
3838
Set-ExecutionPolicy -ExecutionPolicy AllSigned
3939
```
@@ -71,11 +71,11 @@ These steps should be performed before you run the Defender for Cloud cmdlets:
7171
```
7272
7373
1. Auto-provision installation of the Log Analytics agent on your Azure VMs:
74-
74+
7575
```powershell
7676
Set-AzContext -Subscription "d07c0080-170c-4c24-861d-9c817742786c"
7777
```
78-
78+
7979
```powershell
8080
Set-AzSecurityAutoProvisioningSetting -Name "default" -EnableAutoProvision
8181
```
@@ -97,19 +97,17 @@ These steps should be performed before you run the Defender for Cloud cmdlets:
9797
```
9898
9999
```powershell
100-
$Policy = Get-AzPolicySetDefinition | where {$_.Properties.displayName -EQ 'Azure Security Benchmark'}
100+
$Policy = Get-AzPolicySetDefinition | where {$_.Properties.displayName -EQ 'Microsoft cloud security benchmark'}
101101
102-
New-AzPolicyAssignment -Name 'ASC Default <d07c0080-170c-4c24-861d-9c817742786c>' -DisplayName 'Defender for Cloud Default <subscription ID>' -PolicySetDefinition $Policy -Scope '/subscriptions/d07c0080-170c-4c24-861d-9c817742786c'
102+
New-AzPolicyAssignment -Name 'Microsoft cloud security benchmark' -PolicySetDefinition $Policy -Scope '/subscriptions/$($Subscription.Id)'
103103
```
104104
105105
You've successfully onboarded Microsoft Defender for Cloud with PowerShell.
106106
107107
You can now use these PowerShell cmdlets with automation scripts to programmatically iterate across subscriptions and resources. This saves time and reduces the likelihood of human error. You can use this [sample script](https://github.com/Microsoft/Azure-Security-Center/blob/master/quickstarts/ASC-Samples.ps1) as reference.
108108
109-
110-
111-
112109
## See also
110+
113111
To learn more about how you can use PowerShell to automate onboarding to Defender for Cloud, see the following article:
114112
115113
* [Az.Security](/powershell/module/az.security)

0 commit comments

Comments
 (0)