Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Microsoft.Authorization/policy* help generation issues #7938

Merged
merged 2 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"parameters": {
"subscriptionId": "ae640e6b-ba3e-4256-9d62-2993eecfa6f2",
"policyDefinitionName": "EventHubDiagnosticLogs",
"api-version": "2019-09-01",
"parameters": {
"properties": {
"mode": "Indexed",
"displayName": "Event Hubs should have diagnostic logging enabled",
"description": "Audit enabling of logs and retain them up to a year. This enables recreation of activity trails for investigation purposes when a security incident occurs or your network is compromised",
"metadata": {
"category": "Event Hub"
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.EventHub/namespaces"
},
"then": {
"effect": "AuditIfNotExists",
"details": {
"type": "Microsoft.Insights/diagnosticSettings",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.enabled",
"equals": "true"
},
{
"field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.days",
"equals": "[parameters('requiredRetentionDays')]"
}
]
}
}
}
},
"parameters": {
"requiredRetentionDays": {
"type": "Integer",
"defaultValue": 365,
"allowedValues": [
0,
30,
90,
180,
365
],
"metadata": {
"displayName": "Required retention (days)",
"description": "The required diagnostic logs retention in days"
}
}
}
}
}
},
"responses": {
"201": {
"headers": {},
"body": {
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"type": "Microsoft.Authorization/policyDefinitions",
"name": "ResourceNaming",
"properties": {
"mode": "Indexed",
"displayName": "Event Hubs should have diagnostic logging enabled",
"description": "Audit enabling of logs and retain them up to a year. This enables recreation of activity trails for investigation purposes when a security incident occurs or your network is compromised",
"metadata": {
"category": "Event Hub"
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.EventHub/namespaces"
},
"then": {
"effect": "AuditIfNotExists",
"details": {
"type": "Microsoft.Insights/diagnosticSettings",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.enabled",
"equals": "true"
},
{
"field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.days",
"equals": "[parameters('requiredRetentionDays')]"
}
]
}
}
}
},
"parameters": {
"requiredRetentionDays": {
"type": "Integer",
"defaultValue": 365,
"allowedValues": [
0,
30,
90,
180,
365
],
"metadata": {
"displayName": "Required retention (days)",
"description": "The required diagnostic logs retention in days"
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -605,16 +605,19 @@
"ParameterValues": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"value": {
"description": "The value of the parameter.",
"type": "object"
}
}
"$ref": "#/definitions/ParameterValuesValue"
},
"description": "The parameter values for the policy rule. The keys are the parameter names."
},
"ParameterValuesValue": {
"properties": {
"value": {
"description": "The value of the parameter.",
"type": "object"
}
},
"description": "The value of a parameter."
},
"PolicySku": {
"properties": {
"name": {
Expand Down Expand Up @@ -699,14 +702,24 @@
},
"type": {
"type": "string",
"description": "The identity type.",
"description": "The identity type. This is the only required field when adding a system assigned identity to a resource.",
"enum": [
"SystemAssigned",
"None"
],
"x-ms-enum": {
"name": "ResourceIdentityType",
"modelAsString": false
"modelAsString": false,
"values": [
raych1 marked this conversation as resolved.
Show resolved Hide resolved
{
"value": "SystemAssigned",
"description": "Indicates that a system assigned identity is associated with the resource."
},
{
"value": "None",
"description": "Indicates that no identity is associated with the resource or that the existing identity should be removed."
}
]
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
"x-ms-examples": {
"Create or update a policy definition": {
"$ref": "./examples/createOrUpdatePolicyDefinition.json"
},
"Create or update a policy definition with advanced parameters": {
"$ref": "./examples/createOrUpdatePolicyDefinitionAdvancedParams.json"
}
},
"parameters": [
Expand Down Expand Up @@ -520,58 +523,61 @@
},
"description": "The policy definition properties."
},
"ParameterDefinitionsValue": {
"properties": {
"type": {
"description": "The data type of the parameter.",
"type": "string",
"enum": [
"String",
"Array",
"Object",
"Boolean",
"Integer",
"Float",
"DateTime"
],
"x-ms-enum": {
"name": "parameterType",
"modelAsString": true
}
},
"allowedValues": {
"type": "array",
"items": {
"type": "object"
},
"description": "The allowed values for the parameter."
},
"defaultValue": {
"type": "object",
"description": "The default value for the parameter if no value is provided."
},
"metadata": {
"type": "object",
"properties": {
"displayName": {
"type": "string",
"description": "The display name for the parameter."
},
"description": {
"type": "string",
"description": "The description of the parameter."
}
},
"additionalProperties": {
"type": "object"
},
"description": "General metadata for the parameter."
}
},
"description": "The definition of a parameter that can be provided to the policy."
},
"ParameterDefinitions": {
"description": "The parameter definitions for parameters used in the policy. The keys are the parameter names.",
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"type": {
"description": "The data type of the parameter.",
"type": "string",
"enum": [
"String",
"Array",
"Object",
"Boolean",
"Integer",
"Float",
"DateTime"
],
"x-ms-enum": {
"name": "parameterType",
"modelAsString": true
}
},
"allowedValues": {
"type": "array",
"items": {
"type": "object"
},
"description": "The allowed values for the parameter."
},
"defaultValue": {
"type": "object",
"description": "The default value for the parameter if no value is provided."
},
"metadata": {
"type": "object",
"properties": {
"displayName": {
"type": "string",
"description": "The display name for the parameter."
},
"description": {
"type": "string",
"description": "The description of the parameter."
}
},
"additionalProperties": {
"type": "object"
},
"description": "General metadata for the parameter."
}
}
"$ref": "#/definitions/ParameterDefinitionsValue"
}
},
"PolicyDefinition": {
Expand Down