This guide explains how to deploy Custom IoM Rules to CrowdStrike Falcon using the automated bulk deployment script.
- Python 3.7 or higher
- Network access to CrowdStrike Falcon API
- Valid CrowdStrike API credentials with appropriate permissions
Your CrowdStrike API credentials must have:
- Cloud Policies: Read
- Cloud Policies: Write
- Access to Custom IoM Rules functionality
Ensure you have these files in your working directory:
bulk_create_custom_iom_rules_json.py- Main deployment scriptyour_custom_rules.json- Rules to deployconfig.json- Configuration filefalconpy/- FalconPy SDK directory
pip install falconpyEdit the config.json file with your CrowdStrike API credentials:
{
"client_id": "YOUR_CLIENT_ID_HERE",
"client_secret": "YOUR_CLIENT_SECRET_HERE",
"cloud": "us-1"
}Important Notes:
- Replace
YOUR_CLIENT_ID_HEREandYOUR_CLIENT_SECRET_HEREwith your actual credentials - Update the
cloudparameter if you're not using US-1:us-1- US Commercial 1us-2- US Commercial 2eu-1- EU Commercialus-gov-1- US GovCloud
Run a quick test to ensure your credentials work:
python3 -c "from falconpy import CloudPolicies; import json; config=json.load(open('config.json')); falcon=CloudPolicies(**config); print('✅ Connection successful' if falcon.auth_object.authenticated else '❌ Connection failed')"Execute the deployment script:
python3 bulk_create_custom_iom_rules_json.py your_custom_rules.jsonThe script will display real-time progress:
🚀 CrowdStrike Custom IoM Rules Bulk Creator (JSON)
============================================================
🔧 Using Falcon Cloud: us-1
✅ Successfully initialized FalconPy CloudPolicies
📋 Loaded X rules from your_custom_rules.json
🔍 Checking for existing rules...
📊 Found XXX existing custom rules
🎯 CREATING RULES
============================================================
[1/119] Processing: Key Vault secret should have an expiration date
✅ SUCCESS: Rule created (ID: ac96af47-e92d-408f-b887-69f9a634f7c4)
[2/119] Processing: Storage accounts must have a SAS Key Expiration within 30 days
✅ SUCCESS: Rule created (ID: 8484428e-6255-4346-82cb-18276c8ac0ec)
...
At the end, you'll see a summary:
📊 SUMMARY
============================================================
✅ Created: X
⏭️ Skipped: 0
❌ Failed: 0
📋 Total: X
Status Indicators:
- ✅ SUCCESS - Rule created successfully
- ⏭️ SKIPPED - Rule already exists (duplicate detection)
- ❌ FAILED - Rule creation failed (error will be shown)
- Expected: X rules created successfully
- Duration: Approximately 2-3 minutes
- Result: All Custom IoM Rules active in CrowdStrike
- Expected: X rules skipped (already exist)
- Duration: 30-60 seconds
- Result: No duplicates created
- Navigate to Cloud Security > Posture Management > Policies
- Filter by Custom policies
- You should see your new custom rules with names like:
- "Key Vault secret should have an expiration date"
- "Storage accounts must have a SAS Key Expiration within 30 days"
- "App Service HTTPS Only should be enabled"
- etc.
Run this command to count your custom rules:
python3 -c "from falconpy import CloudPolicies; import json; config=json.load(open('config.json')); falcon=CloudPolicies(**config); result=falcon.query_rule(limit=500); print(f'Total custom rules: {len(result[\"body\"][\"resources\"])}')"Error: 401 Unauthorized or authentication errors
Solution:
- Verify your
client_idandclient_secretinconfig.json - Ensure your API credentials have the correct permissions
- Check that you're using the correct cloud region
Error: 403 Forbidden
Solution:
- Your API key needs Cloud Policies: Write permissions
- Contact your CrowdStrike admin to grant appropriate permissions
Error: Connection timeouts or network errors Solution:
- Verify network connectivity to CrowdStrike API endpoints
- Check firewall/proxy settings
- Ensure outbound HTTPS (443) access is allowed
Error: Individual rules fail with "Bad Request" Solution:
- The provided rule file has been tested and validated
- If you see failures, check that you're using the correct rule file format
- Contact support if failures persist
Error: ModuleNotFoundError or import errors
Solution:
pip install --upgrade falconpy
python3 -m pip install falconpybulk_create_custom_iom_rules_json.py- Main deployment scriptyour_custom_rules.json- Your rule set to deployconfig.json- API configuration file
conversion_archive/- Historical files and development work (can be ignored for deployment)
- Never commit
config.jsonwith real credentials to version control - Store API credentials securely (consider using environment variables)
- Rotate API keys according to your security policies
Instead of editing config.json, you can use environment variables:
export CROWDSTRIKE_CLIENT_ID="your_client_id"
export CROWDSTRIKE_CLIENT_SECRET="your_client_secret"
export CROWDSTRIKE_CLOUD="us-1"
# Then modify config.json to reference these:
{
"client_id": "${CROWDSTRIKE_CLIENT_ID}",
"client_secret": "${CROWDSTRIKE_CLIENT_SECRET}",
"cloud": "${CROWDSTRIKE_CLOUD}"
}- Custom IoM Rules for your specific Azure security policies
- Rules cover various Azure services like Key Vault, Storage Accounts, App Services, SQL Server, networking, and more
- Each rule includes description, remediation guidance, and technical details
- Verify all prerequisites are met
- Check the troubleshooting section above
- Ensure you're using the validated rule file
- Test API connectivity independently
✅ Deployment is successful when:
- Script completes without errors
- Summary shows "Created: X" (where X is your rule count)
- CrowdStrike console shows your new custom rules
- All rules are in "Active" status
python3 bulk_create_custom_iom_rules_json.py your_custom_rules.json- First run: X rules created
- Subsequent runs: X rules skipped
- Duration: 2-3 minutes for creation, 30-60 seconds for duplicate detection
- Your rules JSON file should follow the structure defined in
RULE_STRUCTURE.json - Each rule must have validated Rego logic and proper Azure resource types