Hi,
To my understanding this is intended behavior. The UI has certain patterns of configuration that is applied and if some reason that pattern is not according to what it expects it locks the UI to avoid making any mess by applying some other configuration and wiping some existing one. I think even if you change the resource from ExportToWorkspace to something else will not understand that there is existing configuration. So if you are managing the resource via Bicep you should not try to use the portal at all and just use Bicep. As far as I can see you have all the even sources in your template with exception of Alerts but it is up to you if you want to export those or not. If you want to mimic the exact configuration that is applied when you enable all the options without changing any other defaults you can apply these sources:
[
{
eventSource: 'Assessments'
ruleSets: [
{
rules: [
{
propertyJPath: 'type'
propertyType: 'String'
expectedValue: 'Microsoft.Security/assessments'
operator: 'Contains'
}
]
}
]
}
{
eventSource: 'AssessmentsSnapshot'
ruleSets: [
{
rules: [
{
propertyJPath: 'type'
propertyType: 'String'
expectedValue: 'Microsoft.Security/assessments'
operator: 'Contains'
}
]
}
]
}
{
eventSource: 'SubAssessments'
}
{
eventSource: 'SubAssessmentsSnapshot'
}
{
eventSource: 'Alerts'
ruleSets: [
{
rules: [
{
propertyJPath: 'Severity'
propertyType: 'String'
expectedValue: 'low'
operator: 'Equals'
}
]
}
{
rules: [
{
propertyJPath: 'Severity'
propertyType: 'String'
expectedValue: 'medium'
operator: 'Equals'
}
]
}
{
rules: [
{
propertyJPath: 'Severity'
propertyType: 'String'
expectedValue: 'high'
operator: 'Equals'
}
]
}
{
rules: [
{
propertyJPath: 'Severity'
propertyType: 'String'
expectedValue: 'informational'
operator: 'Equals'
}
]
}
]
}
{
eventSource: 'AttackPathsSnapshot'
ruleSets: [
{
rules: [
{
propertyJPath: 'attackPath.riskLevel'
propertyType: 'String'
expectedValue: 'Low'
operator: 'Equals'
}
]
}
{
rules: [
{
propertyJPath: 'attackPath.riskLevel'
propertyType: 'String'
expectedValue: 'Medium'
operator: 'Equals'
}
]
}
{
rules: [
{
propertyJPath: 'attackPath.riskLevel'
propertyType: 'String'
expectedValue: 'High'
operator: 'Equals'
}
]
}
{
rules: [
{
propertyJPath: 'attackPath.riskLevel'
propertyType: 'String'
expectedValue: 'Critical'
operator: 'Equals'
}
]
}
]
}
{
eventSource: 'AttackPaths'
ruleSets: [
{
rules: [
{
propertyJPath: 'attackPath.riskLevel'
propertyType: 'String'
expectedValue: 'Low'
operator: 'Equals'
}
]
}
{
rules: [
{
propertyJPath: 'attackPath.riskLevel'
propertyType: 'String'
expectedValue: 'Medium'
operator: 'Equals'
}
]
}
{
rules: [
{
propertyJPath: 'attackPath.riskLevel'
propertyType: 'String'
expectedValue: 'High'
operator: 'Equals'
}
]
}
{
rules: [
{
propertyJPath: 'attackPath.riskLevel'
propertyType: 'String'
expectedValue: 'Critical'
operator: 'Equals'
}
]
}
]
}
{
eventSource: 'SecureScores'
}
{
eventSource: 'SecureScoresSnapshot'
}
{
eventSource: 'SecureScoreControls'
}
{
eventSource: 'SecureScoreControlsSnapshot'
}
{
eventSource: 'RegulatoryComplianceAssessment'
}
{
eventSource: 'RegulatoryComplianceAssessmentSnapshot'
}
]
As you can see certain rule sets are applied to different categories. Most likely the UI expect those to be present in order to be able to edit it via the UI. My recommendation is still to use just Bicep to manage that at it is more flexible. The UI makes it more complex by requiring specific patterns to be present in the configuration.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.