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:
- A private network for the servers they will add later, with a firewall rule that only lets web traffic in.
- A storage account for their product photos, private by default, with a safe way to share one photo.
- 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 |
Task 1: Find your place in Azure¶
- In the portal, search for Resource groups and open
rg-CLOUD-TEASER-GRP-N. - 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.)
- 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¶
- Search for Virtual networks and select + Create.
-
On Basics:
Setting Value Resource group rg-CLOUD-TEASER-GRP-NVirtual network name vnet-shop-dev-REGION-001Region Your region -
Select Next until you reach IP addresses.
- Change the address space to
10.80.0.0/16. Delete thedefaultsubnet (the bin icon). -
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-00110.80.1.0/24(256 addresses)snet-data-dev-REGION-00110.80.2.0/24(256 addresses) -
Select Next to reach Tags and add the three tags from How you name things.
- 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.
- Search for Network security groups and select + Create.
- Use your resource group, the name
nsg-web-dev-REGION-001and your region. Add the same three tags. Select Review + create, then Create, then Go to resource. - Select Settings → Inbound security rules and look at the three default rules. The last one,
DenyAllInBound, blocks everything that no other rule allows. -
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 100Name allow-http-inbound -
Select Add.
- Select Settings → Subnets → + Associate. Choose
vnet-shop-dev-REGION-001and the subnetsnet-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¶
- Search for Storage accounts and select + Create.
-
On Basics:
Setting Value Resource group rg-CLOUD-TEASER-GRP-NStorage account name stshopdev+ your group number + 3 random letters or digits, for examplestshopdev12k7xRegion 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.
-
Add the three tags on the Tags tab, then select Review + create.
-
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.
-
Go back to Basics and set Redundancy to Locally-redundant storage (LRS).
- 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¶
- Select Data storage → Containers → + Container.
- Name it
photos. Keep the access level Private (no anonymous access). Select Create. - Open
photos, select Upload, choose a small picture from your computer and select Upload.
Try to open it from the internet¶
- Select the picture you uploaded. Copy its URL.
- Open a private browser window (Edge: Ctrl+Shift+N) and paste the URL.
- You see an error such as
PublicAccessNotPermittedorResourceNotFound. This is correct: the container is private.
Share it safely with a SAS link¶
A shared access signature (SAS) is a link that gives limited access for a limited time.
- Back in the portal, on the picture, select Generate SAS.
-
Set:
Setting Value Signing method Account key Permissions Read Expiry 1 hour from now -
Select Generate SAS token and URL and copy the Blob SAS URL.
- 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.
- Search for Container instances and select + Create.
-
On Basics:
Setting Value Resource group rg-CLOUD-TEASER-GRP-NContainer name ci-shop-dev-REGION-001Region Your region SKU Standard Image source Quickstart images Image mcr.microsoft.com/azuredocs/aci-helloworld:latest (Linux) -
Select Change size and set Number of CPU cores to
0.5and Memory (GiB) to0.5. Select OK. - Select Next: Networking. Set DNS name label to
ci-shop-grpN-plus 3 random letters or digits, for exampleci-shop-grp12-k7x. - Select Next: Monitoring and clear the box Enable container instance logs.
- Add the three tags on the Tags tab. Select Review + create, then Create. This takes 2 to 3 minutes.
- 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.
- 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¶
- Open your resource group
rg-CLOUD-TEASER-GRP-N. You should see four resources. - Select Resource visualizer in the menu to see how they are connected.
- 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. - 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.
- In your resource group, select the container instance, the storage account and the virtual network. Select Delete, type
deleteto confirm and select Delete. - When they are gone, select the network security group and delete it the same way.
- 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.