Skip to content

Commit db5d7dc

Browse files
calecarterjnlycklama
authored andcommitted
Calec/new api version (#24542)
* Baseline current api version * Add new version properties/apis * Add new list apis * Sync with main * Update readme files * Updated python readme * reverting to sync with main * updating python and main readme * Fixing some automation failures * add examples for all policyDefinitionVersion apis * Add examples for policy set versions * Updated readme to remove tangling tag * Fix linter issues and and suppression where applicable * Fix linter errors for assignmenets swagger * Fix more linter errors * fix more linter errors * Add schema property to definition parameters to reflect reality * Fix prettier check issues * Updated based on feedback * Fixing linter errors * Fixed more linter errors * Fix JSON syntax error * updated based on feedback to remove RepeatedPathInfo subpression for new apis * Updated subid and api version to use common types
1 parent 32c0cdc commit db5d7dc

File tree

85 files changed

+9785
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+9785
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "ae640e6b-ba3e-4256-9d62-2993eecfa6f2",
4+
"policyDefinitionName": "ResourceNaming",
5+
"api-version": "2023-04-01",
6+
"parameters": {
7+
"properties": {
8+
"mode": "All",
9+
"displayName": "Enforce resource naming convention",
10+
"description": "Force resource names to begin with given 'prefix' and/or end with given 'suffix'",
11+
"metadata": {
12+
"category": "Naming"
13+
},
14+
"policyRule": {
15+
"if": {
16+
"not": {
17+
"field": "name",
18+
"like": "[concat(parameters('prefix'), '*', parameters('suffix'))]"
19+
}
20+
},
21+
"then": {
22+
"effect": "deny"
23+
}
24+
},
25+
"parameters": {
26+
"prefix": {
27+
"type": "String",
28+
"metadata": {
29+
"displayName": "Prefix",
30+
"description": "Resource name prefix"
31+
}
32+
},
33+
"suffix": {
34+
"type": "String",
35+
"metadata": {
36+
"displayName": "Suffix",
37+
"description": "Resource name suffix"
38+
}
39+
}
40+
}
41+
}
42+
}
43+
},
44+
"responses": {
45+
"201": {
46+
"headers": {},
47+
"body": {
48+
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
49+
"type": "Microsoft.Authorization/policyDefinitions",
50+
"name": "ResourceNaming",
51+
"properties": {
52+
"mode": "All",
53+
"displayName": "Naming Convention",
54+
"description": "Force resource names to begin with 'prefix' and end with 'suffix'",
55+
"metadata": {
56+
"category": "Naming"
57+
},
58+
"version": "1.2.1",
59+
"versions": [
60+
"1.2.1",
61+
"1.0.0"
62+
],
63+
"policyRule": {
64+
"if": {
65+
"not": {
66+
"field": "name",
67+
"like": "[concat(parameters('prefix'), '*', parameters('suffix'))]"
68+
}
69+
},
70+
"then": {
71+
"effect": "deny"
72+
}
73+
},
74+
"parameters": {
75+
"prefix": {
76+
"type": "String",
77+
"metadata": {
78+
"displayName": "Prefix",
79+
"description": "Resource name prefix"
80+
}
81+
},
82+
"suffix": {
83+
"type": "String",
84+
"metadata": {
85+
"displayName": "Suffix",
86+
"description": "Resource name suffix"
87+
}
88+
}
89+
},
90+
"policyType": "Custom"
91+
}
92+
}
93+
}
94+
}
95+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "ae640e6b-ba3e-4256-9d62-2993eecfa6f2",
4+
"policyDefinitionName": "EventHubDiagnosticLogs",
5+
"api-version": "2023-04-01",
6+
"parameters": {
7+
"properties": {
8+
"mode": "Indexed",
9+
"displayName": "Event Hubs should have diagnostic logging enabled",
10+
"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",
11+
"metadata": {
12+
"category": "Event Hub"
13+
},
14+
"policyRule": {
15+
"if": {
16+
"field": "type",
17+
"equals": "Microsoft.EventHub/namespaces"
18+
},
19+
"then": {
20+
"effect": "AuditIfNotExists",
21+
"details": {
22+
"type": "Microsoft.Insights/diagnosticSettings",
23+
"existenceCondition": {
24+
"allOf": [
25+
{
26+
"field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.enabled",
27+
"equals": "true"
28+
},
29+
{
30+
"field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.days",
31+
"equals": "[parameters('requiredRetentionDays')]"
32+
}
33+
]
34+
}
35+
}
36+
}
37+
},
38+
"parameters": {
39+
"requiredRetentionDays": {
40+
"type": "Integer",
41+
"defaultValue": 365,
42+
"allowedValues": [
43+
0,
44+
30,
45+
90,
46+
180,
47+
365
48+
],
49+
"metadata": {
50+
"displayName": "Required retention (days)",
51+
"description": "The required diagnostic logs retention in days"
52+
}
53+
}
54+
}
55+
}
56+
}
57+
},
58+
"responses": {
59+
"201": {
60+
"headers": {},
61+
"body": {
62+
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
63+
"type": "Microsoft.Authorization/policyDefinitions",
64+
"name": "ResourceNaming",
65+
"properties": {
66+
"mode": "Indexed",
67+
"displayName": "Event Hubs should have diagnostic logging enabled",
68+
"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",
69+
"metadata": {
70+
"category": "Event Hub"
71+
},
72+
"version": "1.2.1",
73+
"versions": [
74+
"1.2.1",
75+
"1.0.0"
76+
],
77+
"policyRule": {
78+
"if": {
79+
"field": "type",
80+
"equals": "Microsoft.EventHub/namespaces"
81+
},
82+
"then": {
83+
"effect": "AuditIfNotExists",
84+
"details": {
85+
"type": "Microsoft.Insights/diagnosticSettings",
86+
"existenceCondition": {
87+
"allOf": [
88+
{
89+
"field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.enabled",
90+
"equals": "true"
91+
},
92+
{
93+
"field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.days",
94+
"equals": "[parameters('requiredRetentionDays')]"
95+
}
96+
]
97+
}
98+
}
99+
}
100+
},
101+
"parameters": {
102+
"requiredRetentionDays": {
103+
"type": "Integer",
104+
"defaultValue": 365,
105+
"allowedValues": [
106+
0,
107+
30,
108+
90,
109+
180,
110+
365
111+
],
112+
"metadata": {
113+
"displayName": "Required retention (days)",
114+
"description": "The required diagnostic logs retention in days"
115+
}
116+
}
117+
}
118+
}
119+
}
120+
}
121+
}
122+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"parameters": {
3+
"managementGroupId": "MyManagementGroup",
4+
"policyDefinitionName": "ResourceNaming",
5+
"api-version": "2023-04-01",
6+
"parameters": {
7+
"properties": {
8+
"mode": "All",
9+
"displayName": "Enforce resource naming convention",
10+
"description": "Force resource names to begin with given 'prefix' and/or end with given 'suffix'",
11+
"metadata": {
12+
"category": "Naming"
13+
},
14+
"policyRule": {
15+
"if": {
16+
"not": {
17+
"field": "name",
18+
"like": "[concat(parameters('prefix'), '*', parameters('suffix'))]"
19+
}
20+
},
21+
"then": {
22+
"effect": "deny"
23+
}
24+
},
25+
"parameters": {
26+
"prefix": {
27+
"type": "String",
28+
"metadata": {
29+
"displayName": "Prefix",
30+
"description": "Resource name prefix"
31+
}
32+
},
33+
"suffix": {
34+
"type": "String",
35+
"metadata": {
36+
"displayName": "Suffix",
37+
"description": "Resource name suffix"
38+
}
39+
}
40+
}
41+
}
42+
}
43+
},
44+
"responses": {
45+
"201": {
46+
"headers": {},
47+
"body": {
48+
"id": "/providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
49+
"type": "Microsoft.Authorization/policyDefinitions",
50+
"name": "ResourceNaming",
51+
"properties": {
52+
"mode": "All",
53+
"displayName": "Naming Convention",
54+
"description": "Force resource names to begin with 'prefix' and end with 'suffix'",
55+
"metadata": {
56+
"category": "Naming"
57+
},
58+
"version": "1.2.1",
59+
"versions": [
60+
"1.2.1",
61+
"1.0.0"
62+
],
63+
"policyRule": {
64+
"if": {
65+
"not": {
66+
"field": "name",
67+
"like": "[concat(parameters('prefix'), '*', parameters('suffix'))]"
68+
}
69+
},
70+
"then": {
71+
"effect": "deny"
72+
}
73+
},
74+
"parameters": {
75+
"prefix": {
76+
"type": "String",
77+
"metadata": {
78+
"displayName": "Prefix",
79+
"description": "Resource name prefix"
80+
}
81+
},
82+
"suffix": {
83+
"type": "String",
84+
"metadata": {
85+
"displayName": "Suffix",
86+
"description": "Resource name suffix"
87+
}
88+
}
89+
},
90+
"policyType": "Custom"
91+
}
92+
}
93+
}
94+
}
95+
}

0 commit comments

Comments
 (0)