Skip to content

How to deploy NSG security rules from PowerShell #5849

Discussion options

You must be logged in to vote

Thanks, the problem I'm having is I first have to get the security rules from the network security group using PowerShell because of the network intent policy rules enforced for managed instances. These are created by Azure on initial deployment.

For this reason, I can't define the rules in a file, I provided the file above to show a working example of what I'm trying to do. I did get it working by getting the PowerShell to write to a file, like this

$securityRules | ConvertTo-Json -Depth 3 > "$PSScriptRoot\SecurityRules\PolicyRules.json"

and then bicep to read it in with this:

var securityRules = json(loadTextContent('./SecurityRules/PolicyRules.json'))

However for initial deployments th…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@brwilkinson
Comment options

Answer selected by markallisongit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants