Skip to content

Commit 22b72e6

Browse files
authored
Merge pull request #273534 from tomvcassidy/aciPowerShellUpdates
updates to powershell and aci quickstarts
2 parents 4a6e595 + f9e70b6 commit 22b72e6

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

articles/container-instances/container-instances-quickstart-powershell.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ ms.author: tomcassidy
66
author: tomvcassidy
77
ms.service: container-instances
88
services: container-instances
9-
ms.date: 06/17/2022
9+
ms.date: 04/26/2024
1010
ms.custom: devx-track-azurepowershell, mvc, mode-api
1111
---
1212

1313
# Quickstart: Deploy a container instance in Azure using Azure PowerShell
1414

1515
Use Azure Container Instances to run serverless Docker containers in Azure with simplicity and speed. Deploy an application to a container instance on-demand when you don't need a full container orchestration platform like Azure Kubernetes Service.
1616

17-
In this quickstart, you use Azure PowerShell to deploy an isolated Windows container and make its application available with a fully qualified domain name (FQDN). A few seconds after you execute a single deployment command, you can browse to the application running in the container:
17+
In this quickstart, you use Azure PowerShell to deploy an isolated Windows container and make its application available with a fully qualified domain name (FQDN) and port. A few seconds after you execute a single deployment command, you can browse to the application running in the container:
1818

1919
![App deployed to Azure Container Instances viewed in browser][qs-powershell-01]
2020

@@ -36,22 +36,28 @@ First, create a resource group named *myResourceGroup* in the *eastus* location
3636
New-AzResourceGroup -Name myResourceGroup -Location EastUS
3737
```
3838

39+
## Create a port for your container instance
40+
41+
You can expose your containers to the internet by specifying one or more ports to open, a DNS name label, or both. In this quickstart, you deploy a container with a DNS name label so it's publicly reachable. In this guide, we'll do both, but first, you need to create a port object in PowerShell for your container instance to use.
42+
43+
```azurepowershell-interactive
44+
$port = New-AzContainerInstancePortOject -Port 80 -Protocol TCP
45+
```
46+
3947
## Create a container group
4048

41-
Now that you have a resource group, you can run a container in Azure. To create a container instance with Azure PowerShell, you'll first need to create a `ContainerInstanceObject` by providing a name and image for the container. In this quickstart, you use the public `mcr.microsoft.com/windows/servercore/iis:nanoserver` image. This image packages Microsoft Internet Information Services (IIS) to run in Nano Server.
49+
Now that you have a resource group and port, you can run a container that's exposed to the internet in Azure. To create a container instance with Azure PowerShell, you'll first need to create a `ContainerInstanceObject` by providing a name, image, and port for the container. In this quickstart, you use the public `mcr.microsoft.com/azuredocs/aci-helloworld` image.
4250

4351
```azurepowershell-interactive
44-
New-AzContainerInstanceObject -Name myContainer -Image mcr.microsoft.com/windows/servercore/iis:nanoserver
52+
New-AzContainerInstanceObject -Name myContainer -Image mcr.microsoft.com/azuredocs/aci-helloworld -Port @($port)
4553
```
4654

4755
Next, use the [New-AzContainerGroup][New-AzContainerGroup] cmdlet. You need to provide a name for the container group, your resource group's name, a location for the container group, the container instance you just created, the operating system type, and a unique IP address DNS name label.
4856

49-
You can expose your containers to the internet by specifying one or more ports to open, a DNS name label, or both. In this quickstart, you deploy a container with a DNS name label so that IIS is publicly reachable.
50-
5157
Execute a command similar to the following to start a container instance. Set a `-IPAddressDnsNameLabel` value that's unique within the Azure region where you create the instance. If you receive a "DNS name label not available" error message, try a different DNS name label.
5258

5359
```azurepowershell-interactive
54-
New-AzContainerInstanceObject -ResourceGroupName myResourceGroup -Name myContainerGroup -Location EastUS -Container myContainer -OsType Windows -IPAddressDnsNameLabel aci-demo-win
60+
$containerGroup = New-AzContainerInstanceObject -ResourceGroupName myResourceGroup -Name myContainerGroup -Location EastUS -Container myContainer -OsType Windows -IPAddressDnsNameLabel aci-quickstart-win -IpAddressType Public -IPAddressPort @($port)
5561
```
5662

5763
Within a few seconds, you should receive a response from Azure. The container's `ProvisioningState` is initially **Creating**, but should move to **Succeeded** within a minute or two. Check the deployment state with the [Get-AzContainerGroup][Get-AzContainerGroup] cmdlet:
@@ -60,12 +66,17 @@ Within a few seconds, you should receive a response from Azure. The container's
6066
Get-AzContainerGroup -ResourceGroupName myResourceGroup -Name myContainerGroup
6167
```
6268

63-
The container's provisioning state, fully qualified domain name (FQDN), and IP address appear in the cmdlet's output:
69+
You can also print out the $containerGroup object and filter the table for the container's provisioning state, fully qualified domain name (FQDN), and IP address.
70+
71+
```azurepowershell-interactive
72+
$containerGroup | Format-Table InstanceViewState, IPAddressFqdn, IPAddressIP
73+
```
74+
75+
The container's provisioning state, FQDN, and IP address appear in the cmdlet's output:
6476

6577
```console
6678
PS Azure:\> Get-AzContainerGroup -ResourceGroupName myResourceGroup -Name myContainerGroup
6779

68-
6980
ResourceGroupName : myResourceGroup
7081
Id : /subscriptions/<Subscription ID>/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/myContainerGroup
7182
Name : myContainerGroup
@@ -86,9 +97,9 @@ State : Pending
8697
Events : {}
8798
```
8899

89-
Once the container's `ProvisioningState` is **Succeeded**, navigate to its `Fqdn` in your browser. If you see a web page similar to the following, congratulations! You've successfully deployed an application running in a Docker container to Azure.
100+
If the container's `ProvisioningState` is **Succeeded**, go to its FQDN in your browser. If you see a web page similar to the following, congratulations! You've successfully deployed an application running in a Docker container to Azure.
90101

91-
![IIS deployed using Azure Container Instances viewed in browser][qs-powershell-01]
102+
![View an app deployed to Azure Container Instances in browser][./media/container-instances-quickstart/view-an-application-running-in-an-azure-container-instance.png]
92103

93104
## Clean up resources
94105

@@ -105,9 +116,6 @@ In this quickstart, you created an Azure container instance from an image in the
105116
> [!div class="nextstepaction"]
106117
> [Azure Container Instances tutorial](./container-instances-tutorial-prepare-app.md)
107118
108-
<!-- IMAGES -->
109-
[qs-powershell-01]: ./media/container-instances-quickstart-powershell/qs-powershell-01.png
110-
111119
<!-- LINKS -->
112120
[New-AzResourceGroup]: /powershell/module/az.resources/new-Azresourcegroup
113121
[New-AzContainerGroup]: /powershell/module/az.containerinstance/new-Azcontainergroup

articles/container-instances/container-instances-quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: tomcassidy
66
author: tomvcassidy
77
ms.service: container-instances
88
services: container-instances
9-
ms.date: 06/17/2022
9+
ms.date: 04/26/2024
1010
ms.custom: mvc, devx-track-azurecli, mode-api
1111
---
1212

0 commit comments

Comments
 (0)