This guide covers how to export custom rules that are already deployed on Sentinel and how to test them.
If you have yet to create a custom rule, please refer to the following guide by Microsoft. Create custom analytics rules to detect threats. Once done, follow the steps described below.
To convert the rules from JSON to yaml manually. Please refer to the example below for the format and fill in accordingly.
Text format to copy paste
id: 71736563-3347-3634-5747-5638374a4253 incidentConfiguration: createIncident: true grouping: enabled: false groupByAlertDetails: [] groupByCustomDetails: [] groupByEntities: [] lookbackDuration: PT5H matchingMethod: AllEntities reopenClosedIncident: false displayName: 'DNS events related to mining pools' description: | Identifies IP addresses that may be performing DNS lookups associated with common currency mining pools. severity: Low enabled: true query: | DnsEvents | where Name contains "." | where Name has_any ("monerohash.com", "do-dear.com", "xmrminerpro.com", "secumine.net", "xmrpool.com", "minexmr.org", "hashanywhere.com", "xmrget.com", "mininglottery.eu", "minergate.com", "moriaxmr.com", "multipooler.com", "moneropools.com", "xmrpool.eu", "coolmining.club", "supportxmr.com", "minexmr.com", "hashvault.pro", "xmrpool.net", "crypto-pool.fr", "xmr.pt", "miner.rocks", "walpool.com", "herominers.com", "gntl.co.uk", "semipool.com", "coinfoundry.org", "cryptoknight.cc", "fairhash.org", "baikalmine.com", "tubepool.xyz", "fairpool.xyz", "asiapool.io", "coinpoolit.webhop.me", "nanopool.org", "moneropool.com", "miner.center", "prohash.net", "poolto.be", "cryptoescrow.eu", "monerominers.net", "cryptonotepool.org", "extrmepool.org", "webcoin.me", "kippo.eu", "hashinvest.ws", "monero.farm", "supportxmr.com", "xmrpool.eu", "linux-repository-updates.com", "1gh.com", "dwarfpool.com", "hash-to-coins.com", "hashvault.pro", "pool-proxy.com", "hashfor.cash", "fairpool.cloud", "litecoinpool.org", "mineshaft.ml", "abcxyz.stream", "moneropool.ru", "cryptonotepool.org.uk", "extremepool.org", "extremehash.com", "hashinvest.net", "unipool.pro", "crypto-pools.org", "monero.net", "backup-pool.com", "mooo.com", "freeyy.me", "cryptonight.net", "shscrypto.net") | extend timestamp = TimeGenerated, IPCustomEntity = ClientIP, HostCustomEntity = Computer queryFrequency: 1D queryPeriod: 1D triggerOperator: GreaterThan triggerThreshold: 0 suppressionDuration: PT5H suppressionEnabled: false entityMappings: - entityType: Host fieldMappings: - identifier: FullName columnName: HostCustomEntity - entityType: IP fieldMappings: - identifier: Address columnName: IPCustomEntity tactics: ['Impact'] techniques: ['T1496'] kind: Scheduled |
Note Please take special note on the entity mapping and refer to this document to understand better and the best practices |
Once you have converted the rules, you can now perform testing to check if they will be deployed correctly.
azure/dev/southeastasia/<prefix>-log-analytics/services/
sentinel-rules-testing
config.hcl
and terragrunt.hcl
from the sentinel-rules
foldercontent/rules
config.hcl
remove the comment from # content_path_rules = "content/rules"
The final folder structure should look like this
content/rules
folder you have just createdconfig.hcl
and under the additional_rules
field add in each of the custom rulesIt should be look similar to this
Please note that if you have specified a different content_path_rules
you will have to follow that instead.
az login
and select the appropriate accountaz account set --subscription <SUBSCRIPTION_ID>
to set your subscription.sentinel-rules-testing
terragrunt plan
terragrunt apply
yes
when promptedOnce your testing is complete, clean up the Sentinel by running terragrunt destroy
to delete the newly created custom rules on Sentinel
If you wish to deploy these on customer environment please refer correct guide below.
This section covers some of the potential errors that you may face and how to resolve them.
Please check if you are logged into the correct Azure account with the correct subscription set.
If the error still persist, run az logout
and sign in by following Logging into Azure and setting subscription
Run the following command
terragrunt init |
If the error you are facing is not one of the above, you can execute the following command to enable debugging.
terragrunt plan --terragrunt-log-level debug --terragrunt-debug