-
Notifications
You must be signed in to change notification settings - Fork 761
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a673ae2
commit 70402e3
Showing
10 changed files
with
697 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
...pts/Install monitoring agent on VMSS/Azure Policy - DeployIfNotExists/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Deploy Vulnerability Assesment on SQL Managed Instance | ||
|
||
This collection of samples is for remediating the "Monitoring agent should be installed on virtual machine scale sets" recommendtation in Azure Security Center using Azure Policy. There is a | ||
built-in policy for enabling in Azure Policy called "Deploy Log Analytics Agent for Windows\Linux VM Scale Sets" that | ||
can be duplicated and edited for managed instances. |
10 changes: 10 additions & 0 deletions
10
Remediation scripts/Install monitoring agent on VMSS/Logic App/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Logic Apps sample playbook to remediate | ||
This sample playbook allows you to install the monitoring agent on your Linux and Windows virtual machine scale set. According to ASC's recommendation *"Monitoring agent should be installed on virtual machine scale sets"* | ||
The playbook leverages a "Managed Identity" which needs to be configured after deployment. This "Managed Identity" also requires the appropriate permissions on the resources that you would like to remediate. | ||
|
||
|
||
<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2FAzure-Security-Center%2Fmaster%2FSecure%2520Score%2FInstall%20Monitring%20Agent%20on%20VMSS%2FLogic%20App%2Fazuredeploy.json" target="_blank"> | ||
<img src="http://azuredeploy.net/deploybutton.png"/> | ||
</a> | ||
|
||
|
612 changes: 612 additions & 0 deletions
612
Remediation scripts/Install monitoring agent on VMSS/Logic App/azuredeploy.json
Large diffs are not rendered by default.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
Remediation scripts/Install monitoring agent on VMSS/PowerShell/Install_VMSS.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
$publicSettings = @{"workspaceId" = "Add_your_workspaceID"} | ||
$protectedSettings = @{"workspaceKey" = "Add_Your_WorkspaceKey"} | ||
|
||
|
||
$scaleSets = Get-AzVmss -ResourceGroupName $ResourceGroupName -VMScaleSetName $VMScaleSetName | ||
$scaleSets = Get-AzVmss | ||
|
||
foreach ($scaleSet in $scaleSets) | ||
{ | ||
#check if the MMA agent is already install | ||
if($scaleSet.VirtualMachineProfile.ExtensionProfile.Extensions.name -contains "MicrosoftMonitoringAgent"){ | ||
write-host agent on $scaleSet.Name is already installed no action was taken -ForeGroundColor yellow | ||
|
||
} | ||
else | ||
{ | ||
write-host agent on $scaleSet.Name is not installed -ForeGroundColor Green | ||
|
||
#checking if this is Windows VM | ||
if($scaleSet.VirtualMachineProfile.StorageProfile.ImageReference.Offer -match "Windows"){ | ||
Write-Host "Installing VMSS Extension of type Windows ....please wait..." -ForeGroundColor Green | ||
Add-AzVmssExtension -VirtualMachineScaleSet $scaleSet -Name MicrosoftMonitoringAgent -Publisher "Microsoft.EnterpriseCloud.Monitoring" -Type "MicrosoftMonitoringAgent" -TypeHandlerVersion 1.0 -AutoUpgradeMinorVersion $True -Setting $publicSettings -ProtectedSetting $protectedSetting | ||
|
||
} | ||
else{ | ||
Write-Host "Installing VMSS Extension of type Linux ....please wait..." -ForeGroundColor Green | ||
Add-AzVmssExtension -VirtualMachineScaleSet $scaleSet -Name MicrosoftMonitoringAgent -Publisher "Microsoft.EnterpriseCloud.Monitoring" -Type "OmsAgentForLinux" -TypeHandlerVersion 1.7 -AutoUpgradeMinorVersion $True -Setting $publicSettings -ProtectedSetting $protectedSetting | ||
|
||
} | ||
Update-AzVmss -ResourceGroupName $scaleset.ResourceGroupName -VMScaleSetName $scaleset.Name -VirtualMachineScaleSet $scaleset | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
Remediation scripts/Install monitoring agent on VMSS/PowerShell/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# PowerShell script to remediate | ||
|
||
This sample script is provided to remediate the "Monitoring agent should be installed on virtual machine scale sets" | ||
recommendation in Azure Security Center. The script will except as input workspaceKey and Workspace ID | ||
and loop through each VMSS and install MMA agents on it. |
13 changes: 13 additions & 0 deletions
13
Remediation scripts/Install monitoring agent on VMSS/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Contributing | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit https://cla.microsoft.com. | ||
|
||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.