-
Notifications
You must be signed in to change notification settings - Fork 762
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into antmarti/external_res…
…ources
- Loading branch information
Showing
144 changed files
with
37,217 additions
and
27,860 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
docs/examples/201/policy-definition-with-assignment/main.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
targetScope = 'subscription' | ||
|
||
param listOfAllowedLocations array = [ | ||
'norwayeast' | ||
'westeurope' | ||
] | ||
|
||
param policyEffect string { | ||
allowed: [ | ||
'Audit' | ||
'Deny' | ||
] | ||
} | ||
|
||
resource locationPolicyDefinition 'Microsoft.Authorization/policyDefinitions@2020-09-01' = { | ||
name: 'custom-allowed-location' | ||
properties: { | ||
displayName: 'Custom - allowed location for resources' | ||
policyType: 'Custom' | ||
description: 'Use policy to restrict where resources can be deployed' | ||
parameters: { | ||
allowedLocations: { | ||
type: 'Array' | ||
} | ||
effect: { | ||
type: 'String' | ||
} | ||
} | ||
metadata: { | ||
category: 'Locations' | ||
} | ||
policyRule: { | ||
if: { | ||
allOf: [ | ||
{ | ||
field: 'location' | ||
notIn: '[parameters(\'allowedLocations\')]' | ||
} | ||
{ | ||
field: 'location' | ||
notEquals: 'global' | ||
} | ||
{ | ||
field: 'type' | ||
notEquals: 'Microsoft.AzureActiveDirectory/b2cDirectories' | ||
} | ||
] | ||
} | ||
then: { | ||
effect: '[parameters(\'effect\')]' | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource locationPolicy 'Microsoft.Authorization/policyAssignments@2020-09-01' = { | ||
name: 'Resource-location-restriction' | ||
properties: { | ||
policyDefinitionId: locationPolicyDefinition.id | ||
displayName: 'Restrict location for Azure resources' | ||
description: 'Policy will either Audit or Deny resources being deployed in other locations' | ||
parameters: { | ||
allowedLocations: { | ||
value: listOfAllowedLocations | ||
} | ||
Effect: { | ||
value: policyEffect | ||
} | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
docs/examples/201/policy-definition-with-assignment/main.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"listOfAllowedLocations": { | ||
"type": "array", | ||
"defaultValue": [ | ||
"norwayeast", | ||
"westeurope" | ||
] | ||
}, | ||
"policyEffect": { | ||
"type": "string", | ||
"allowedValues": [ | ||
"Audit", | ||
"Deny" | ||
] | ||
} | ||
}, | ||
"functions": [], | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"apiVersion": "2020-09-01", | ||
"name": "custom-allowed-location", | ||
"properties": { | ||
"displayName": "Custom - allowed location for resources", | ||
"policyType": "Custom", | ||
"description": "Use policy to restrict where resources can be deployed", | ||
"parameters": { | ||
"allowedLocations": { | ||
"type": "Array" | ||
}, | ||
"effect": { | ||
"type": "String" | ||
} | ||
}, | ||
"metadata": { | ||
"category": "Locations" | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "location", | ||
"notIn": "[[parameters('allowedLocations')]" | ||
}, | ||
{ | ||
"field": "location", | ||
"notEquals": "global" | ||
}, | ||
{ | ||
"field": "type", | ||
"notEquals": "Microsoft.AzureActiveDirectory/b2cDirectories" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[[parameters('effect')]" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Authorization/policyAssignments", | ||
"apiVersion": "2020-09-01", | ||
"name": "Resource-location-restriction", | ||
"properties": { | ||
"policyDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/policyDefinitions', 'custom-allowed-location')]", | ||
"displayName": "Restrict location for Azure resources", | ||
"description": "Policy will either Audit or Deny resources being deployed in other locations", | ||
"parameters": { | ||
"allowedLocations": { | ||
"value": "[parameters('listOfAllowedLocations')]" | ||
}, | ||
"Effect": { | ||
"value": "[parameters('policyEffect')]" | ||
} | ||
} | ||
}, | ||
"dependsOn": [ | ||
"[subscriptionResourceId('Microsoft.Authorization/policyDefinitions', 'custom-allowed-location')]" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/Bicep.Core.Samples/Files/Completions/childCompletions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[ | ||
{ | ||
"label": "empty.bicep", | ||
"kind": "file", | ||
"deprecated": false, | ||
"preselect": false, | ||
"sortText": "1_empty.bicep", | ||
"filterText": "'ChildModules/empty.bicep'", | ||
"insertTextFormat": "plainText", | ||
"insertTextMode": "asIs", | ||
"textEdit": { | ||
"range": {}, | ||
"newText": "'ChildModules/empty.bicep'" | ||
} | ||
}, | ||
{ | ||
"label": "main.bicep", | ||
"kind": "file", | ||
"deprecated": false, | ||
"preselect": false, | ||
"sortText": "1_main.bicep", | ||
"filterText": "'ChildModules/main.bicep'", | ||
"insertTextFormat": "plainText", | ||
"insertTextMode": "asIs", | ||
"textEdit": { | ||
"range": {}, | ||
"newText": "'ChildModules/main.bicep'" | ||
} | ||
}, | ||
{ | ||
"label": "modulea.bicep", | ||
"kind": "file", | ||
"deprecated": false, | ||
"preselect": false, | ||
"sortText": "1_modulea.bicep", | ||
"filterText": "'ChildModules/modulea.bicep'", | ||
"insertTextFormat": "plainText", | ||
"insertTextMode": "asIs", | ||
"textEdit": { | ||
"range": {}, | ||
"newText": "'ChildModules/modulea.bicep'" | ||
} | ||
} | ||
] |
44 changes: 44 additions & 0 deletions
44
src/Bicep.Core.Samples/Files/Completions/childDotCompletions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[ | ||
{ | ||
"label": "empty.bicep", | ||
"kind": "file", | ||
"deprecated": false, | ||
"preselect": false, | ||
"sortText": "1_empty.bicep", | ||
"filterText": "'./ChildModules/empty.bicep'", | ||
"insertTextFormat": "plainText", | ||
"insertTextMode": "asIs", | ||
"textEdit": { | ||
"range": {}, | ||
"newText": "'./ChildModules/empty.bicep'" | ||
} | ||
}, | ||
{ | ||
"label": "main.bicep", | ||
"kind": "file", | ||
"deprecated": false, | ||
"preselect": false, | ||
"sortText": "1_main.bicep", | ||
"filterText": "'./ChildModules/main.bicep'", | ||
"insertTextFormat": "plainText", | ||
"insertTextMode": "asIs", | ||
"textEdit": { | ||
"range": {}, | ||
"newText": "'./ChildModules/main.bicep'" | ||
} | ||
}, | ||
{ | ||
"label": "modulea.bicep", | ||
"kind": "file", | ||
"deprecated": false, | ||
"preselect": false, | ||
"sortText": "1_modulea.bicep", | ||
"filterText": "'./ChildModules/modulea.bicep'", | ||
"insertTextFormat": "plainText", | ||
"insertTextMode": "asIs", | ||
"textEdit": { | ||
"range": {}, | ||
"newText": "'./ChildModules/modulea.bicep'" | ||
} | ||
} | ||
] |
Oops, something went wrong.