{
    "id": "0692518e-1a5b-42ae-9278-64f9ef4378d4",
    "name": "Configure Network Security Groups",
    "slug": "configure-network-security-groups",
    "status": "published",
    "lab_type": "pta",
    "is_sample": false,
    "duration_in_seconds": 1800,
    "metadata": {
        "courses": [
            "26f9ad91-c452-41bd-87ea-284a1e3de3f3",
            "9d8d4179-9915-4895-95e6-178f7ca69436",
            "6ebab230-9dc9-4ce8-b913-9d0272210bbe",
            "841fd5c8-3e7d-414a-936e-413b2508ce4d"
        ],
        "pta_sdn": "387",
        "pta_namespace": "my.ine",
        "learning_paths": [],
        "has_published_parent": true
    },
    "session": null,
    "company": "a491bc32-c056-4946-9169-cc053387bada",
    "created": "2022-10-07T16:45:07.949322Z",
    "modified": "2023-10-03T18:58:04.571844Z",
    "is_beta": false,
    "lab_objectives": [],
    "main_learning_area": "d3f82c70-f4e7-428e-afd7-4b1d28988e18",
    "learning_areas": [
        {
            "id": "d3f82c70-f4e7-428e-afd7-4b1d28988e18",
            "name": "Cloud",
            "slug": "cloud"
        }
    ],
    "categories": [],
    "tags": [],
    "difficulty": null,
    "is_web_access": true,
    "is_lab_experience": false,
    "is_featured": false,
    "cve": null,
    "severity": null,
    "year": null,
    "classification": null,
    "is_trackable": false,
    "cpe_credits": null,
    "is_skill_check": false,
    "external_url": "",
    "solution_video": null,
    "explanation_video": null,
    "description": "The goal of this task is to control access to public facing virtual machines. There are three virtual machines in a single subnet. Two of the virtual machines serve a web application over port 80, and one serves as an SFTP server. The SFTP server is configured to listen to a non-standard port - 50001. Completing this task will allow only the required access to the servers using a single network security group.",
    "description_html": "<p>The goal of this task is to control access to public facing virtual machines. There are three virtual machines in a single subnet. Two of the virtual machines serve a web application over port 80, and one serves as an SFTP server. The SFTP server is configured to listen to a non-standard port - 50001. Completing this task will allow only the required access to the servers using a single network security group.</p>",
    "tasks": "",
    "tasks_html": "",
    "published_date": "2020-12-10T21:09:05Z",
    "solutions": "# Implement application security groups\n\nWhen you will login to the azure with the provided credentials, you will find some predeployed resources. This is all you will need for this lab.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/1.png)\n\nSearch for *asg* and open the **Application security groups** service as highlighted below.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/2.png)\n\nClick on **Create** to start creating the application security group.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/3.png)\n\nConfigure the ASG as below:\n\n* Use the assigned resource group\n\n* Name the asg as **web-asg**\n\nClick on **Review + Create**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/4.png)\n\nAzure will verify the configuration and it will show **Validation passed**. Click on **Create** to provision the ASG.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/5.png)\n\nIt will take few seconds to deploy the ASG. You will see *Your deployment is complete* which means ASG is provisioned.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/6.png)\n\nGo to the **public-web1-vm** and open the **Networking**. Here under **Application security groups** click on **Add asg** as highlighted below.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/7.png)\n\nChoose the **web-asg** ASG which we created just now and click on **Save**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/8.png)\n\nIn the same manner, go to the **public-web2-vm** and open the **Networking**. Here under **Application security groups** click on **Add asg** as highlighted below.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/9.png)\n\nChoose the **web-asg** ASG which we created just now and click on **Save**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/10.png)\n\nNow go and create one more ASG with below configurations:\n\n* Use the assigned resource group\n\n* Name the ASG as **sftp-asg**\n\nClick on **Review + Create**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/11.png)\n\nAzure will verify the configuration and it will show **Validation passed**. Click on **Create** to provision the ASG.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/12.png)\n\nIt will take few seconds to deploy the ASG. You will see *Your deployment is complete* which means ASG is provisioned.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/13.png)\n\nGo to the **public-ftp-vm** and open the **Networking**. Here under **Application security groups** click on **Add asg** as highlighted below.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/14.png)\n\nChoose the **sftp-asg** ASG which we created just now and click on **Save**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/15.png)\n\n# Implement a network security group\n\nSearch for *nsg* and open the **Network security groups** service as highlighted below.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/16.png)\n\nClick on **Create** to start creating the network security group.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/17.png)\n\nConfigure the NSG as below:\n\n* Use the assigned resource group\n\n* Name the nsg as **edge-nsg**\n\nClick on **Review + Create**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/18.png)\n\nAzure will verify the configuration and it will show **Validation passed**. Click on **Create** to provision the NSG.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/19.png)\n\nIt will take few seconds to deploy the NSG. You will see *Your deployment is complete* which means NSG is provisioned. Click on **Go to resource** to check the NSG.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/20.png)\n\nHere navigate to **Inbound security rules** and click on **Add** to add new rule.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/21.png)\n\nConfigure the rule as below:\n\n* Set the destination of rule as **Application security group** and select **web-asg**\n\n* Set the destination port as **80**\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/22.png)\n\n* Choose the protocol as **Any** and action as **Allow**\n\n* Set the priority as **100** and name the rule as **HTTP**\n\nClick on **Add** to add this rule.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/23.png)\n\nIn the same manner add one more rule with below configuration:\n\n* Set the destination of rule as **Application security group** and select **sftp-asg**\n\n* Set the destination port as **50001**\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/24.png)\n\n* Choose the protocol as **Any** and action as **Allow**\n\n* Set the priority as **110** and name the rule as **SFTP**\n\nClick on **Add** to add this rule.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/25.png)\n\nNow navigate to the **Subnets** of NSG and click on **+ Associate** to associate this NSG with a subnet.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/26.png)\n\nChoose the virtual network as **public-vnet** and subnet as **edge**.\n\nClick on **OK** to associate the NSG with this subnet.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/27.png)\n\n# Verify the network security group\n\n**Note:** It may take a few minutes for the NSG to fully take effect. Wait for few minutes to actually test it out.\n\nOpen the virtual machines service and note down the public IP addresses of all three servers. Try to open these in your browser.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/28.png)\n\nPublic IP address of web1 VM will revert back with it's name.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/29.png)\n\nIn same manner web2 VM will show you below output.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/30.png)\n\nBut you will see that you are unable to access the ftp-vm server from the public IP address.\n\nThis means that our NSG is working properly.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/31.png)\n\nYou can also verify that ftp-vm is only not avaliable on public network. There is indeed a web server running.\n\nNavigate to the either of web-vm and click on **Connect**. Choose **Bastion** option to connect.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/32.png)\n\nUse the **student** username and **Passw0rd!** password to connect to the VM. Click on **Connect**.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/33.png)\n\nA new window with SSH session to the web1-vm will open.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/34.png)\n\nGo to the public-ftp-vm and note down private IP address of virtual machine.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/35.png)\n\nUse the below command to access the webserver of ftp-vm from web1-vm.\n\n```\ncurl http://PrivateIpAddress\n```\n\nYou will see that it will revert back with name of the VM. This means that there is server running on the VM but we can't access it because of the NSG.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/36.png)\n\nOur lab is now complete.",
    "solutions_html": "<h1>Implement application security groups</h1>\n<p>When you will login to the azure with the provided credentials, you will find some predeployed resources. This is all you will need for this lab.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/1.png\" /></p>\n<p>Search for <em>asg</em> and open the <strong>Application security groups</strong> service as highlighted below.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/2.png\" /></p>\n<p>Click on <strong>Create</strong> to start creating the application security group.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/3.png\" /></p>\n<p>Configure the ASG as below:</p>\n<ul>\n<li>\n<p>Use the assigned resource group</p>\n</li>\n<li>\n<p>Name the asg as <strong>web-asg</strong></p>\n</li>\n</ul>\n<p>Click on <strong>Review + Create</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/4.png\" /></p>\n<p>Azure will verify the configuration and it will show <strong>Validation passed</strong>. Click on <strong>Create</strong> to provision the ASG.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/5.png\" /></p>\n<p>It will take few seconds to deploy the ASG. You will see <em>Your deployment is complete</em> which means ASG is provisioned.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/6.png\" /></p>\n<p>Go to the <strong>public-web1-vm</strong> and open the <strong>Networking</strong>. Here under <strong>Application security groups</strong> click on <strong>Add asg</strong> as highlighted below.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/7.png\" /></p>\n<p>Choose the <strong>web-asg</strong> ASG which we created just now and click on <strong>Save</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/8.png\" /></p>\n<p>In the same manner, go to the <strong>public-web2-vm</strong> and open the <strong>Networking</strong>. Here under <strong>Application security groups</strong> click on <strong>Add asg</strong> as highlighted below.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/9.png\" /></p>\n<p>Choose the <strong>web-asg</strong> ASG which we created just now and click on <strong>Save</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/10.png\" /></p>\n<p>Now go and create one more ASG with below configurations:</p>\n<ul>\n<li>\n<p>Use the assigned resource group</p>\n</li>\n<li>\n<p>Name the ASG as <strong>sftp-asg</strong></p>\n</li>\n</ul>\n<p>Click on <strong>Review + Create</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/11.png\" /></p>\n<p>Azure will verify the configuration and it will show <strong>Validation passed</strong>. Click on <strong>Create</strong> to provision the ASG.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/12.png\" /></p>\n<p>It will take few seconds to deploy the ASG. You will see <em>Your deployment is complete</em> which means ASG is provisioned.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/13.png\" /></p>\n<p>Go to the <strong>public-ftp-vm</strong> and open the <strong>Networking</strong>. Here under <strong>Application security groups</strong> click on <strong>Add asg</strong> as highlighted below.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/14.png\" /></p>\n<p>Choose the <strong>sftp-asg</strong> ASG which we created just now and click on <strong>Save</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/15.png\" /></p>\n<h1>Implement a network security group</h1>\n<p>Search for <em>nsg</em> and open the <strong>Network security groups</strong> service as highlighted below.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/16.png\" /></p>\n<p>Click on <strong>Create</strong> to start creating the network security group.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/17.png\" /></p>\n<p>Configure the NSG as below:</p>\n<ul>\n<li>\n<p>Use the assigned resource group</p>\n</li>\n<li>\n<p>Name the nsg as <strong>edge-nsg</strong></p>\n</li>\n</ul>\n<p>Click on <strong>Review + Create</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/18.png\" /></p>\n<p>Azure will verify the configuration and it will show <strong>Validation passed</strong>. Click on <strong>Create</strong> to provision the NSG.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/19.png\" /></p>\n<p>It will take few seconds to deploy the NSG. You will see <em>Your deployment is complete</em> which means NSG is provisioned. Click on <strong>Go to resource</strong> to check the NSG.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/20.png\" /></p>\n<p>Here navigate to <strong>Inbound security rules</strong> and click on <strong>Add</strong> to add new rule.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/21.png\" /></p>\n<p>Configure the rule as below:</p>\n<ul>\n<li>\n<p>Set the destination of rule as <strong>Application security group</strong> and select <strong>web-asg</strong></p>\n</li>\n<li>\n<p>Set the destination port as <strong>80</strong></p>\n</li>\n</ul>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/22.png\" /></p>\n<ul>\n<li>\n<p>Choose the protocol as <strong>Any</strong> and action as <strong>Allow</strong></p>\n</li>\n<li>\n<p>Set the priority as <strong>100</strong> and name the rule as <strong>HTTP</strong></p>\n</li>\n</ul>\n<p>Click on <strong>Add</strong> to add this rule.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/23.png\" /></p>\n<p>In the same manner add one more rule with below configuration:</p>\n<ul>\n<li>\n<p>Set the destination of rule as <strong>Application security group</strong> and select <strong>sftp-asg</strong></p>\n</li>\n<li>\n<p>Set the destination port as <strong>50001</strong></p>\n</li>\n</ul>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/24.png\" /></p>\n<ul>\n<li>\n<p>Choose the protocol as <strong>Any</strong> and action as <strong>Allow</strong></p>\n</li>\n<li>\n<p>Set the priority as <strong>110</strong> and name the rule as <strong>SFTP</strong></p>\n</li>\n</ul>\n<p>Click on <strong>Add</strong> to add this rule.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/25.png\" /></p>\n<p>Now navigate to the <strong>Subnets</strong> of NSG and click on <strong>+ Associate</strong> to associate this NSG with a subnet.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/26.png\" /></p>\n<p>Choose the virtual network as <strong>public-vnet</strong> and subnet as <strong>edge</strong>.</p>\n<p>Click on <strong>OK</strong> to associate the NSG with this subnet.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/27.png\" /></p>\n<h1>Verify the network security group</h1>\n<p><strong>Note:</strong> It may take a few minutes for the NSG to fully take effect. Wait for few minutes to actually test it out.</p>\n<p>Open the virtual machines service and note down the public IP addresses of all three servers. Try to open these in your browser.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/28.png\" /></p>\n<p>Public IP address of web1 VM will revert back with it's name.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/29.png\" /></p>\n<p>In same manner web2 VM will show you below output.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/30.png\" /></p>\n<p>But you will see that you are unable to access the ftp-vm server from the public IP address.</p>\n<p>This means that our NSG is working properly.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/31.png\" /></p>\n<p>You can also verify that ftp-vm is only not avaliable on public network. There is indeed a web server running.</p>\n<p>Navigate to the either of web-vm and click on <strong>Connect</strong>. Choose <strong>Bastion</strong> option to connect.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/32.png\" /></p>\n<p>Use the <strong>student</strong> username and <strong>Passw0rd!</strong> password to connect to the VM. Click on <strong>Connect</strong>.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/33.png\" /></p>\n<p>A new window with SSH session to the web1-vm will open.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/34.png\" /></p>\n<p>Go to the public-ftp-vm and note down private IP address of virtual machine.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/35.png\" /></p>\n<p>Use the below command to access the webserver of ftp-vm from web1-vm.</p>\n<pre class=\"codehilite\"><code>curl http://PrivateIpAddress</code></pre>\n\n<p>You will see that it will revert back with name of the VM. This means that there is server running on the VM but we can't access it because of the NSG.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/configure-network-security-groups/36.png\" /></p>\n<p>Our lab is now complete.</p>",
    "flags": [],
    "min_points_to_pass": null,
    "access_type": "web",
    "user_status": "unstarted",
    "user_lab_status": null,
    "user_status_modified": null,
    "user_flags": [],
    "global_running_session": null
}