Giter Site home page Giter Site logo

az-bicep-nsg's Introduction

Network Security Group (NSG)

CLI

l="eastus2";                                                            echo $l
env="prod";                                                             echo $env
project="bicephub";                                                     echo $env
tags="env=$env project=$project";                                       echo $tags
rg="rg-nsg-$project-$env-$l";                                           echo $rg
sub_id='########-####-####-####-############';                          echo $sub_id

# Default NSG
# nsg_n="nsg-default-$project-$env-$l";                                   echo $nsg_n
# AGW NSG
nsg_n="nsg-agw-$project-$env-$l";                                       echo $nsg_n


# RG
az group create \
--subscription $sub_id \
--name $rg \
--location $l  \
--tags $tags

# NSG
az network nsg create \
--name $nsg_n \
--subscription $sub_id \
--resource-group $rg \
--location $l \
--tags $tags

# -----------------------------------------------------------------------------------------------
#  RDP
# -----------------------------------------------------------------------------------------------
az network nsg rule create \
--direction Inbound \
--source-address-prefixes "*" \
--source-port-ranges "*" \
--destination-address-prefixes VirtualNetwork \
--destination-port-ranges 3389 \
--protocol "TCP" \
--access Allow \
--priority 100 \
--name AllowRdpInbound \
--nsg-name $nsg_n \
--subscription $sub_id \
--resource-group $rg

# -----------------------------------------------------------------------------------------------
#  SSH
# -----------------------------------------------------------------------------------------------
az network nsg rule create \
--direction Inbound \
--source-address-prefixes "*" \
--source-port-ranges "*" \
--destination-address-prefixes VirtualNetwork \
--destination-port-ranges 22 \
--protocol "TCP" \
--access Allow \
--priority 200 \
--name AllowSshInbound \
--nsg-name $nsg_n \
--subscription $sub_id \
--resource-group $rg

# -----------------------------------------------------------------------------------------------
#  AGW V1
# -----------------------------------------------------------------------------------------------
# AllowGatewayManagerInbound
az network nsg rule create \
--direction Inbound \
--priority 300 \
--destination-port-ranges 65503-65534 \
--protocol TCP \
--source-address-prefixes GatewayManager \
--destination-address-prefixes "*" \
--access Allow \
--name AllowGatewayManagerInbound \
--nsg-name $nsg_n \
--subscription $sub_id \
--resource-group $rg

# -----------------------------------------------------------------------------------------------
#  AGW V2
# -----------------------------------------------------------------------------------------------
# AllowGatewayManagerInbound
az network nsg rule create \
--direction Inbound \
--priority 400 \
--destination-port-ranges 65200-65535 \
--protocol TCP \
--source-address-prefixes GatewayManager \
--destination-address-prefixes "*" \
--access Allow \
--name AllowGatewayManagerInbound \
--nsg-name $nsg_n \
--subscription $sub_id \
--resource-group $rg

# -----------------------------------------------------------------------------------------------
#  FD
# -----------------------------------------------------------------------------------------------
# AllowAzureFrontDoor.BackendInbound
az network nsg rule create \
--direction Inbound \
--priority 500 \
--destination-port-ranges 443 80 \
--protocol TCP \
--source-address-prefixes AzureFrontDoor.Backend \
--destination-address-prefixes VirtualNetwork \
--access Allow \
--name AllowAzureFrontDoor.Backend \
--nsg-name $nsg_n \
--subscription $sub_id \
--resource-group $rg

Additional Resources

az-bicep-nsg's People

Contributors

artiomlk avatar

Watchers

 avatar

az-bicep-nsg's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.