-
Notifications
You must be signed in to change notification settings - Fork 437
NSG: Moved NSG Security Rules into its own child-module #1102
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
9 changes: 9 additions & 0 deletions
9
arm/Microsoft.Network/networkSecurityGroups/.parameters/min.parameters.json
This file contains hidden or 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,9 @@ | ||
| { | ||
| "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", | ||
| "contentVersion": "1.0.0.0", | ||
| "parameters": { | ||
| "name": { | ||
| "value": "<<namePrefix>>-az-nsg-min-001" | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
1 change: 1 addition & 0 deletions
1
arm/Microsoft.Network/networkSecurityGroups/securityRules/.bicep/nested_cuaId.bicep
This file contains hidden or 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 @@ | ||
|
|
110 changes: 110 additions & 0 deletions
110
arm/Microsoft.Network/networkSecurityGroups/securityRules/deploy.bicep
This file contains hidden or 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,110 @@ | ||
| @sys.description('Required. The name of the security rule') | ||
| param name string | ||
|
|
||
| @sys.description('Required. The name of the network security group to deploy the security rule into') | ||
| param networkSecurityGroupName string | ||
|
|
||
| @sys.description('Optional. Whether network traffic is allowed or denied.') | ||
| @allowed([ | ||
| 'Allow' | ||
| 'Deny' | ||
| ]) | ||
| param access string = 'Deny' | ||
|
|
||
| @sys.description('Optional. A description for this rule') | ||
| @maxLength(140) | ||
| param description string = '' | ||
|
|
||
| @sys.description('Optional. The destination address prefix. CIDR or destination IP range. Asterisk "*" can also be used to match all source IPs. Default tags such as "VirtualNetwork", "AzureLoadBalancer" and "Internet" can also be used.') | ||
| param destinationAddressPrefix string = '' | ||
|
|
||
| @sys.description('Optional. The destination address prefixes. CIDR or destination IP ranges.') | ||
| param destinationAddressPrefixes array = [] | ||
|
|
||
| @sys.description('Optional. The application security group specified as destination.') | ||
| param destinationApplicationSecurityGroups array = [] | ||
|
|
||
| @sys.description('Optional. The destination port or range. Integer or range between 0 and 65535. Asterisk "*" can also be used to match all ports.') | ||
| param destinationPortRange string = '' | ||
|
|
||
| @sys.description('Optional. The destination port ranges.') | ||
| param destinationPortRanges array = [] | ||
|
|
||
| @sys.description('Required. The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.') | ||
| @allowed([ | ||
| 'Inbound' | ||
| 'Outbound' | ||
| ]) | ||
| param direction string | ||
|
|
||
| @sys.description('Required. The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.') | ||
| param priority int | ||
|
|
||
| @sys.description('Required. Network protocol this rule applies to.') | ||
| @allowed([ | ||
| '*' | ||
| 'Ah' | ||
| 'Esp' | ||
| 'Icmp' | ||
| 'Tcp' | ||
| 'Udp' | ||
| ]) | ||
| param protocol string | ||
|
|
||
| @sys.description('Optional. The CIDR or source IP range. Asterisk "*" can also be used to match all source IPs. Default tags such as "VirtualNetwork", "AzureLoadBalancer" and "Internet" can also be used. If this is an ingress rule, specifies where network traffic originates from.') | ||
| param sourceAddressPrefix string = '' | ||
|
|
||
| @sys.description('Optional. The CIDR or source IP ranges.') | ||
| param sourceAddressPrefixes array = [] | ||
|
|
||
| @sys.description('Optional. The application security group specified as source.') | ||
| param sourceApplicationSecurityGroups array = [] | ||
|
|
||
| @sys.description('Optional. The source port or range. Integer or range between 0 and 65535. Asterisk "*" can also be used to match all ports.') | ||
| param sourcePortRange string = '' | ||
|
|
||
| @sys.description('Optional. The source port ranges.') | ||
| param sourcePortRanges array = [] | ||
|
|
||
| @sys.description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered') | ||
| param cuaId string = '' | ||
|
|
||
| module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) { | ||
| name: 'pid-${cuaId}' | ||
| params: {} | ||
| } | ||
|
|
||
| resource networkSecurityGroup 'Microsoft.Network/networkSecurityGroups@2021-05-01' existing = { | ||
| name: networkSecurityGroupName | ||
| } | ||
|
|
||
| resource securityRule 'Microsoft.Network/networkSecurityGroups/securityRules@2021-05-01' = { | ||
| name: name | ||
| parent: networkSecurityGroup | ||
| properties: { | ||
| access: access | ||
| description: description | ||
| destinationAddressPrefix: destinationAddressPrefix | ||
| destinationAddressPrefixes: destinationAddressPrefixes | ||
| destinationApplicationSecurityGroups: destinationApplicationSecurityGroups | ||
| destinationPortRange: destinationPortRange | ||
| destinationPortRanges: destinationPortRanges | ||
| direction: direction | ||
| priority: priority | ||
| protocol: protocol | ||
| sourceAddressPrefix: sourceAddressPrefix | ||
| sourceAddressPrefixes: sourceAddressPrefixes | ||
| sourceApplicationSecurityGroups: sourceApplicationSecurityGroups | ||
| sourcePortRange: sourcePortRange | ||
| sourcePortRanges: sourcePortRanges | ||
| } | ||
| } | ||
|
|
||
| @sys.description('The resource group the security rule was deployed into') | ||
| output resourceGroupName string = resourceGroup().name | ||
|
|
||
| @sys.description('The resource ID of the security rule') | ||
| output resourceId string = securityRule.id | ||
|
|
||
| @sys.description('The name of the security rule') | ||
| output name string = securityRule.name |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.