Azure Cloud Shell script¶
# Install Azure AD module if not already installed
Install-Module -Name AzureAD
# Connect to Azure AD
Connect-AzureAD
# Replace with your group ID
$groupId = "ef559700-c7d9-4def-bf90-1941037b2224"
# Read the securityEnabled property
$group = Get-AzureADGroup -ObjectId $groupId
Write-Host "Current securityEnabled property: $($group.securityEnabled)"
# Update the securityEnabled property to true
Set-AzureADGroup -ObjectId $groupId -SecurityEnabled $true
# Verify the update
$updatedGroup = Get-AzureADGroup -ObjectId $groupId
Write-Host "Updated securityEnabled property: $($updatedGroup.securityEnabled)"