1
- ---
1
+ ---
2
2
external help file : Microsoft.Azure.Commands.ContainerInstance.dll-Help.xml
3
- Module Name : AzureRM
3
+ Module Name : AzureRM.ContainerInstance
4
4
online version : https://docs.microsoft.com/en-us/powershell/module/azurerm.containerinstance/new-azurermcontainergroup
5
5
schema : 2.0.0
6
6
---
@@ -15,28 +15,38 @@ Creates a container group.
15
15
### CreateContainerGroupBaseParamSet (Default)
16
16
```
17
17
New-AzureRmContainerGroup [-ResourceGroupName] <String> [-Name] <String> -Image <String> [-Location <String>]
18
- [-OsType <String>] [-Cpu <Int32 >] [-MemoryInGB <Double >] [-IpAddressType <String >] [-Port <Int32 >]
19
- [-Command <String>] [-EnvironmentVariable <Hashtable>] [-Tag <Hashtable>]
18
+ [-OsType <String>] [-RestartPolicy <String >] [-Cpu <Int32 >] [-MemoryInGB <Double >] [-IpAddressType <String >]
19
+ [-Ports <Int32[]>] [- Command <String>] [-EnvironmentVariable <Hashtable>] [-Tag <Hashtable>]
20
20
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
21
21
```
22
22
23
23
### CreateContainerGroupWithRegistryParamSet
24
24
```
25
25
New-AzureRmContainerGroup [-ResourceGroupName] <String> [-Name] <String> -Image <String> [-Location <String>]
26
- [-OsType <String>] [-Cpu <Int32 >] [-MemoryInGB <Double >] [-IpAddressType <String >] [-Port <Int32 >]
27
- [-Command <String>] [-EnvironmentVariable <Hashtable>] [-RegistryServerDomain <String>]
26
+ [-OsType <String>] [-RestartPolicy <String >] [-Cpu <Int32 >] [-MemoryInGB <Double >] [-IpAddressType <String >]
27
+ [-Ports <Int32[]>] [- Command <String>] [-EnvironmentVariable <Hashtable>] [-RegistryServerDomain <String>]
28
28
-RegistryCredential <PSCredential> [-Tag <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
29
29
[-Confirm] [<CommonParameters>]
30
30
```
31
31
32
+ ### CreateContainerGroupWithAzureFileMountParamSet
33
+ ```
34
+ New-AzureRmContainerGroup [-ResourceGroupName] <String> [-Name] <String> -Image <String> [-Location <String>]
35
+ [-OsType <String>] [-RestartPolicy <String>] [-Cpu <Int32>] [-MemoryInGB <Double>] [-IpAddressType <String>]
36
+ [-Ports <Int32[]>] [-Command <String>] [-EnvironmentVariable <Hashtable>] -AzureFileVolumeShareName <String>
37
+ -AzureFileVolumeAccountName <String> -AzureFileVolumeAccountKey <PSCredential>
38
+ -AzureFileVolumeMountPath <String> [-Tag <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
39
+ [-Confirm] [<CommonParameters>]
40
+ ```
41
+
32
42
## DESCRIPTION
33
43
The ** New-AzureRmContainerGroup** cmdlets creates a container group.
34
44
35
45
## EXAMPLES
36
46
37
47
### Example 1
38
48
```
39
- PS C:\> New-AzureRmContainerGroup -ResourceGroupName demo -Name mycontainer -Image nginx -OsType Linux -IpAddressType Public -Port 8000
49
+ PS C:\> New-AzureRmContainerGroup -ResourceGroupName demo -Name mycontainer -Image nginx -OsType Linux -IpAddressType Public -Ports @( 8000)
40
50
41
51
ResourceGroupName : demo
42
52
Id : /subscriptions/ae43b1e3-c35d-4c8c-bc0d-f148b4c52b78/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
@@ -52,6 +62,8 @@ IpAddress : 13.88.10.240
52
62
Ports : {8000}
53
63
OsType : Linux
54
64
Volumes :
65
+ State : Running
66
+ Events : {}
55
67
```
56
68
57
69
This commands creates a container group using latest nginx image and requests a public IP address with opening port 8000.
@@ -74,11 +86,37 @@ IpAddress :
74
86
Ports :
75
87
OsType : Linux
76
88
Volumes :
89
+ State : Running
90
+ Events : {}
77
91
```
78
92
79
93
This commands creates a container group and runs a custom script inside the container.
80
94
81
- ### Example 3: Creates a container group using image in Azure Container Registry
95
+ ### Example 3: Creates a run-to-completion container group.
96
+ ```
97
+ PS C:\> New-AzureRmContainerGroup -ResourceGroupName demo -Name mycontainer -Image alpine -OsType Linux -Command "echo hello" -RestartPolicy Never
98
+
99
+ ResourceGroupName : demo
100
+ Id : /subscriptions/ae43b1e3-c35d-4c8c-bc0d-f148b4c52b78/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
101
+ Name : mycontainer
102
+ Type : Microsoft.ContainerInstance/containerGroups
103
+ Location : westus
104
+ Tags :
105
+ ProvisioningState : Creating
106
+ Containers : {mycontainer}
107
+ ImageRegistryCredentials :
108
+ RestartPolicy :
109
+ IpAddress :
110
+ Ports :
111
+ OsType : Linux
112
+ Volumes :
113
+ State : Running
114
+ Events : {}
115
+ ```
116
+
117
+ This commands creates a container group which prints out 'hello' and stops.
118
+
119
+ ### Example 4: Creates a container group using image in Azure Container Registry
82
120
```
83
121
PS C:\> $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
84
122
PS C:\> $mycred = New-Object System.Management.Automation.PSCredential ("myacr", $secpasswd)
@@ -98,11 +136,13 @@ IpAddress : 13.88.10.240
98
136
Ports : {80}
99
137
OsType : Linux
100
138
Volumes :
139
+ State : Running
140
+ Events : {}
101
141
```
102
142
103
143
This commands creates a container group using a nginx image in Azure Container Registry.
104
144
105
- ### Example 4 : Creates a container group using image in custom container image registry
145
+ ### Example 5 : Creates a container group using image in custom container image registry
106
146
```
107
147
PS C:\> $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
108
148
PS C:\> $mycred = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
@@ -122,12 +162,92 @@ IpAddress : 13.88.10.240
122
162
Ports : {80}
123
163
OsType : Linux
124
164
Volumes :
165
+ State : Running
166
+ Events : {}
125
167
```
126
168
127
169
This commands creates a container group using a custom image from a custom container image registry.
128
170
171
+ ### Example 6: Creates a container group that mounts Azure File volume
172
+ ```
173
+ PS C:\> $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
174
+ PS C:\> $mycred = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
175
+ PS C:\> New-AzureRmContainerGroup -ResourceGroupName MyResourceGroup -Name MyContainer -Image alpine -AzureFileVolumeShareName myshare -AzureFileVolumeAccountName mystorage -AzureFileVolumeAccountKey $mycred -AzureFileVolumeMountPath /mnt/azfile
176
+
177
+ ResourceGroupName : demo
178
+ Id : /subscriptions/ae43b1e3-c35d-4c8c-bc0d-f148b4c52b78/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
179
+ Name : mycontainer
180
+ Type : Microsoft.ContainerInstance/containerGroups
181
+ Location : westus
182
+ Tags :
183
+ ProvisioningState : Creating
184
+ Containers : {mycontainer}
185
+ ImageRegistryCredentials : {myserver.com}
186
+ RestartPolicy :
187
+ IpAddress : 13.88.10.240
188
+ Ports : {80}
189
+ OsType : Linux
190
+ Volumes : {AzureFile}
191
+ State : Running
192
+ Events : {}
193
+ ```
194
+
195
+ This commands creates a container group that mounts the provided Azure File share to ` /mnt/azfile ` .
196
+
129
197
## PARAMETERS
130
198
199
+ ### -AzureFileVolumeAccountKey
200
+ The storage account key of the Azure File share to mount.```yaml
201
+ Type: PSCredential
202
+ Parameter Sets: CreateContainerGroupWithAzureFileMountParamSet
203
+ Aliases:
204
+
205
+ Required: True
206
+ Position: Named
207
+ Default value: None
208
+ Accept pipeline input: False
209
+ Accept wildcard characters: False
210
+ ```
211
+
212
+ ### -AzureFileVolumeAccountName
213
+ The storage account name of the Azure File share to mount.```yaml
214
+ Type: String
215
+ Parameter Sets: CreateContainerGroupWithAzureFileMountParamSet
216
+ Aliases:
217
+
218
+ Required: True
219
+ Position: Named
220
+ Default value: None
221
+ Accept pipeline input: False
222
+ Accept wildcard characters: False
223
+ ```
224
+
225
+ ### -AzureFileVolumeMountPath
226
+ The mount path for the Azure File volume.```yaml
227
+ Type: String
228
+ Parameter Sets: CreateContainerGroupWithAzureFileMountParamSet
229
+ Aliases:
230
+
231
+ Required: True
232
+ Position: Named
233
+ Default value: None
234
+ Accept pipeline input: False
235
+ Accept wildcard characters: False
236
+ ```
237
+
238
+ ### -AzureFileVolumeShareName
239
+ The name of the Azure File share to mount.```yaml
240
+ Type: String
241
+ Parameter Sets: CreateContainerGroupWithAzureFileMountParamSet
242
+ Aliases:
243
+
244
+ Required: True
245
+ Position: Named
246
+ Default value: None
247
+ Accept pipeline input: False
248
+ Accept wildcard characters: False
249
+ ```
250
+
131
251
### -Command
132
252
The command to run in the container.
133
253
@@ -284,12 +404,9 @@ Accept pipeline input: False
284
404
Accept wildcard characters : False
285
405
` ` `
286
406
287
- ### -Port
288
- The port to open.
289
- Default: 80
290
-
291
- ` ` ` yaml
292
- Type : Int32
407
+ ### -Ports
408
+ The ports to open. Default: [80]` ` ` yaml
409
+ Type : Int32[]
293
410
Parameter Sets : (All)
294
411
Aliases :
295
412
@@ -345,6 +462,20 @@ Accept pipeline input: True (ByPropertyName)
345
462
Accept wildcard characters : False
346
463
` ` `
347
464
465
+ ### -RestartPolicy
466
+ The container restart policy. Default: Always` ` ` yaml
467
+ Type : String
468
+ Parameter Sets : (All)
469
+ Aliases :
470
+ Accepted values : Always, Never, OnFailure
471
+
472
+ Required : False
473
+ Position : Named
474
+ Default value : None
475
+ Accept pipeline input : False
476
+ Accept wildcard characters : False
477
+ ` ` `
478
+
348
479
### -Tag
349
480
{{Fill Tag Description}}
350
481
0 commit comments