-
Notifications
You must be signed in to change notification settings - Fork 48
Solution #49
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
base: main
Are you sure you want to change the base?
Solution #49
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| { | ||
| "resourcesTemplate": "" | ||
| "resourcesTemplate": "https://matestoragevlp15.blob.core.windows.net/task-artifacts/task16/exported-template.json?sv=2025-07-05&se=2026-07-19T11%3A12%3A49Z&sr=b&sp=r&sig=5Xd%2F%2F1%2FHSRk7RSjHCln23zv2tTgLxShWCytrxAtzDIo%3D" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,16 +15,52 @@ Write-Host "Creating a resource group $resourceGroupName ..." | |
| New-AzResourceGroup -Name $resourceGroupName -Location $location | ||
|
|
||
| Write-Host "Creating web network security group..." | ||
| # Write your code for creation of Web NSG here -> | ||
| # Write your code for creation of Web NSG here -> | ||
| $webHttpRule = New-AzNetworkSecurityRuleConfig ` | ||
| -Name "AllowHttpHttpsInbound" ` | ||
| -Description "Allow HTTP and HTTPS traffic from the Internet" ` | ||
| -Access Allow ` | ||
| -Protocol Tcp ` | ||
| -Direction Inbound ` | ||
| -Priority 100 ` | ||
| -SourceAddressPrefix Internet ` | ||
| -SourcePortRange * ` | ||
| -DestinationAddressPrefix * ` | ||
| -DestinationPortRange 80, 443 | ||
| $webNsg = New-AzNetworkSecurityGroup ` | ||
| -Name $webSubnetName ` | ||
| -ResourceGroupName $resourceGroupName ` | ||
| -Location $location ` | ||
| -SecurityRules $webHttpRule | ||
|
|
||
| Write-Host "Creating mngSubnet network security group..." | ||
| # Write your code for creation of management NSG here -> | ||
| # Write your code for creation of management NSG here -> | ||
| $mngSshRule = New-AzNetworkSecurityRuleConfig ` | ||
| -Name "AllowSshInbound" ` | ||
| -Description "Allow SSH traffic from the Internet" ` | ||
| -Access Allow ` | ||
| -Protocol Tcp ` | ||
| -Direction Inbound ` | ||
| -Priority 100 ` | ||
| -SourceAddressPrefix Internet ` | ||
| -SourcePortRange * ` | ||
| -DestinationAddressPrefix * ` | ||
| -DestinationPortRange 22 | ||
| $mngNsg = New-AzNetworkSecurityGroup ` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This NSG currently has only the SSH-from-Internet rule; double-check whether you must explicitly allow traffic from |
||
| -Name $mngSubnetName ` | ||
| -ResourceGroupName $resourceGroupName ` | ||
| -Location $location ` | ||
| -SecurityRules $mngSshRule | ||
|
|
||
| Write-Host "Creating dbSubnet network security group..." | ||
| # Write your code for creation of management NSG here -> | ||
| # Write your code for creation of management NSG here -> | ||
| $dbNsg = New-AzNetworkSecurityGroup ` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The database NSG has no explicit inbound rules, which correctly blocks Internet traffic; however, if the tests require explicit intra-VNet allow rules, you may need to add a rule that allows traffic from |
||
| -Name $dbSubnetName ` | ||
| -ResourceGroupName $resourceGroupName ` | ||
| -Location $location | ||
|
|
||
| Write-Host "Creating a virtual network ..." | ||
| $webSubnet = New-AzVirtualNetworkSubnetConfig -Name $webSubnetName -AddressPrefix $webSubnetIpRange | ||
| $dbSubnet = New-AzVirtualNetworkSubnetConfig -Name $dbSubnetName -AddressPrefix $dbSubnetIpRange | ||
| $mngSubnet = New-AzVirtualNetworkSubnetConfig -Name $mngSubnetName -AddressPrefix $mngSubnetIpRange | ||
| $webSubnet = New-AzVirtualNetworkSubnetConfig -Name $webSubnetName -AddressPrefix $webSubnetIpRange -NetworkSecurityGroup $webNsg | ||
| $dbSubnet = New-AzVirtualNetworkSubnetConfig -Name $dbSubnetName -AddressPrefix $dbSubnetIpRange -NetworkSecurityGroup $dbNsg | ||
| $mngSubnet = New-AzVirtualNetworkSubnetConfig -Name $mngSubnetName -AddressPrefix $mngSubnetIpRange -NetworkSecurityGroup $mngNsg | ||
| New-AzVirtualNetwork -Name $virtualNetworkName -ResourceGroupName $resourceGroupName -Location $location -AddressPrefix $vnetAddressPrefix -Subnet $webSubnet,$dbSubnet,$mngSubnet | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment still says "Write your code" – the implementation is present and correct for web NSG creation, but consider verifying whether you also need an explicit rule here to allow VNet (inter-subnet) traffic, instead of relying only on default NSG behavior, since the task explicitly mentions allowing traffic from other subnets.