diff --git a/artifacts.json b/artifacts.json index 94af6d6..38933c7 100644 --- a/artifacts.json +++ b/artifacts.json @@ -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" } diff --git a/task.ps1 b/task.ps1 index cd5b2d7..a6df983 100644 --- a/task.ps1 +++ b/task.ps1 @@ -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 ` + -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 ` + -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