Skip to content

Lab: Set up Kopi Corner's first cloud environment

At a glance

  • Time: about 75 minutes
  • Region: your own, from the table in Your region. It depends on your group number.
  • You create: 1 virtual network with 2 subnets, 1 network security group, 1 storage account and 1 container instance
  • Cost: a few cents in total, paid by us. You delete everything at the end.

The story

Kopi Corner is a small coffee shop that is moving to the cloud. They have hired you as their first Azure administrator. Today you prepare three things:

  1. A private network for the servers they will add later, with a firewall rule that only lets web traffic in.
  2. A storage account for their product photos, private by default, with a safe way to share one photo.
  3. A small website, running in a container, that anyone on the internet can open.

What you will learn

  • How Azure is organised: resource groups, regions and access.
  • How to name and tag resources so that a team can find, manage and pay for them.
  • How to build a virtual network, subnets and a network security group.
  • How to store files in a storage account and share one with a SAS link.
  • How to run a container without managing any servers.
  • How guardrails stop mistakes before they cost money.

Your region

Azure runs in many regions: groups of data centers in one part of the world. Each group of participants works in one region, so that nobody runs out of capacity in a busy one. Find your group number in the table and use that region for everything you create.

Your group number Your region Region code
1 to 17 Southeast Asia sea
18 to 34 East Asia ea
35 to 50 Malaysia West myw

Wherever the lab says your region, choose yours. Wherever a name contains REGION, replace it with your region code. For example, if your number is 20, your region is East Asia, and vnet-shop-dev-REGION-001 becomes vnet-shop-dev-ea-001.

Another region is refused

Your group's guardrail allows only your own region. If you pick another one, the validation fails with [LAB-P01A-REGION] and a message that names your region.

How you name things

Companies name their Azure resources with a fixed pattern, so anyone can tell what a resource is from its name. You follow the pattern from Microsoft's Cloud Adoption Framework:

<resource type>-<workload>-<environment>-<region>-<instance>

Part In this lab Meaning
Resource type vnet, snet, nsg, st, ci virtual network, subnet, network security group, storage account, container instance
Workload shop or web what it is for
Environment dev development, not production
Region REGION your region code from the table above (sea, ea or myw)
Instance 001 the first one

The framework asks for a region part in every name, but it doesn't fix the abbreviations. This lab uses the short codes in the table above.

You also add three tags (name and value pairs) to every resource:

Tag name Value
workload shop
environment dev
session teaser
Diagram: in your teaser resource group, a virtual network vnet-shop-dev-REGION-001 with a web subnet protected by the network security group nsg-web-dev-REGION-001 and a data subnet; a storage account with a private photos container shared by a SAS link; and a container instance that serves a public website. A storage account with geo-redundant storage is blocked by a guardrail.
Everything you build today, in your own resource group. Select the diagram to open it full size.

Task 1: Find your place in Azure

  1. In the portal, search for Resource groups and open rg-CLOUD-TEASER-GRP-N.
  2. Look at the Overview page. Note the Subscription. The group is empty. (Its Location is only where Azure keeps the group's own details. The resources you create go in your region.)
  3. Select Access control (IAM), then View my access. You have the role Lab Teaser Participant on this resource group, and nothing else: no other resource group and no other part of the subscription.

Think about it

You can create resources in your resource group only. Why is it a good idea to give people access to one resource group rather than the whole subscription?

Task 2: Build the network

Create the virtual network

  1. Search for Virtual networks and select + Create.
  2. On Basics:

    Setting Value
    Resource group rg-CLOUD-TEASER-GRP-N
    Virtual network name vnet-shop-dev-REGION-001
    Region Your region
  3. Select Next until you reach IP addresses.

  4. Change the address space to 10.80.0.0/16. Delete the default subnet (the bin icon).
  5. Select + Add a subnet and add these two subnets, one at a time. Keep the other settings as they are.

    Name Starting address Size
    snet-web-dev-REGION-001 10.80.1.0 /24 (256 addresses)
    snet-data-dev-REGION-001 10.80.2.0 /24 (256 addresses)
  6. Select Next to reach Tags and add the three tags from How you name things.

  7. Select Review + create, then Create.

A network costs nothing

Virtual networks and subnets are free. You pay for what you put in them.

Add a firewall rule with a network security group

A network security group (NSG) is a list of rules that allows or denies traffic.

  1. Search for Network security groups and select + Create.
  2. Use your resource group, the name nsg-web-dev-REGION-001 and your region. Add the same three tags. Select Review + create, then Create, then Go to resource.
  3. Select Settings → Inbound security rules and look at the three default rules. The last one, DenyAllInBound, blocks everything that no other rule allows.
  4. Select + Add and create this rule:

    Setting Value
    Source Service Tag
    Source service tag Internet
    Destination Any
    Service HTTP (port 80 is filled in)
    Action Allow
    Priority 100
    Name allow-http-inbound
  5. Select Add.

  6. Select Settings → Subnets → + Associate. Choose vnet-shop-dev-REGION-001 and the subnet snet-web-dev-REGION-001. Select OK.

Think about it

The web subnet now allows only web traffic from the internet. The data subnet has no NSG. Which subnet would you put a database in, and what rule would you give it?

Task 3: Store and share photos

Create the storage account and meet a guardrail

  1. Search for Storage accounts and select + Create.
  2. On Basics:

    Setting Value
    Resource group rg-CLOUD-TEASER-GRP-N
    Storage account name stshopdev + your group number + 3 random letters or digits, for example stshopdev12k7x
    Region Your region
    Primary service (or Preferred storage type) Azure Blob Storage or Azure Data Lake Storage Gen 2
    Performance Standard
    Redundancy Geo-redundant storage (GRS). This is a mistake on purpose.

    Storage names are different

    A storage account name becomes part of a public web address, so it must be unique in all of Azure, and it can have only lowercase letters and digits (3 to 24). That is why it has no hyphens.

  3. Add the three tags on the Tags tab, then select Review + create.

  4. The validation fails. Read the message. It starts with [LAB-P05A-STORAGE-SKU].

    Geo-redundant storage (GRS) keeps a second copy in another region. It costs about twice as much, and Kopi Corner doesn't need it yet. A guardrail (an Azure Policy rule) stopped the mistake before anything was created.

  5. Go back to Basics and set Redundancy to Locally-redundant storage (LRS).

  6. Select Review + create, then Create. When it finishes, select Go to resource.

Think about it

What is better: a guardrail that blocks a costly setting, or a report at the end of the month that shows what it cost?

Upload a photo

  1. Select Data storage → Containers → + Container.
  2. Name it photos. Keep the access level Private (no anonymous access). Select Create.
  3. Open photos, select Upload, choose a small picture from your computer and select Upload.

Try to open it from the internet

  1. Select the picture you uploaded. Copy its URL.
  2. Open a private browser window (Edge: Ctrl+Shift+N) and paste the URL.
  3. You see an error such as PublicAccessNotPermitted or ResourceNotFound. This is correct: the container is private.

A shared access signature (SAS) is a link that gives limited access for a limited time.

  1. Back in the portal, on the picture, select Generate SAS.
  2. Set:

    Setting Value
    Signing method Account key
    Permissions Read
    Expiry 1 hour from now
  3. Select Generate SAS token and URL and copy the Blob SAS URL.

  4. Paste it in the private window. Your picture opens.

Think about it

Anyone with the SAS link can open the picture until it expires. Why does a short expiry matter?

Task 4: Run the website in a container

A container packs an application with everything it needs. Azure Container Instances runs it without any server for you to manage, and you pay by the second.

  1. Search for Container instances and select + Create.
  2. On Basics:

    Setting Value
    Resource group rg-CLOUD-TEASER-GRP-N
    Container name ci-shop-dev-REGION-001
    Region Your region
    SKU Standard
    Image source Quickstart images
    Image mcr.microsoft.com/azuredocs/aci-helloworld:latest (Linux)
  3. Select Change size and set Number of CPU cores to 0.5 and Memory (GiB) to 0.5. Select OK.

  4. Select Next: Networking. Set DNS name label to ci-shop-grpN- plus 3 random letters or digits, for example ci-shop-grp12-k7x.
  5. Select Next: Monitoring and clear the box Enable container instance logs.
  6. Add the three tags on the Tags tab. Select Review + create, then Create. This takes 2 to 3 minutes.
  7. Select Go to resource. When Status is Running, copy the FQDN and open it in a new browser tab. You see Welcome to Azure Container Instances.
  8. Back in the portal, select Settings → Containers → Logs. You see a line for each request from your browser.

Small on purpose

Half a CPU is enough for a test website. Larger containers are blocked by a guardrail ([LAB-P09A-CONTAINER-INSTANCE]).

Task 5: See the whole picture

  1. Open your resource group rg-CLOUD-TEASER-GRP-N. You should see four resources.
  2. Select Resource visualizer in the menu to see how they are connected.
  3. On the Overview page, select Add filter → session → teaser. Tags let you find every resource of a project in one step, and see what it costs.
  4. Select Activity log. Every change you made today is recorded, with who made it and when.

Task 6: Clean up

Resources cost money while they exist, so a good administrator deletes what is no longer needed.

  1. In your resource group, select the container instance, the storage account and the virtual network. Select Delete, type delete to confirm and select Delete.
  2. When they are gone, select the network security group and delete it the same way.
  3. Refresh. Your resource group is empty again.

Why two steps?

The NSG is attached to a subnet, so Azure deletes the network first. If you delete everything at once, the NSG may fail the first time. Then just delete it again.

Check your work

  • Your virtual network has two subnets, and the web subnet has an NSG that allows HTTP.
  • Your storage account was blocked with [LAB-P05A-STORAGE-SKU] and then created with LRS.
  • The picture's normal URL failed, and the SAS URL worked.
  • The container's FQDN showed the welcome page.
  • Your resource group is empty again.

When you are done, see What's next.