Skip to content

Commit dea6847

Browse files
authored
Merge pull request #259122 from MicrosoftDocs/repo_sync_working_branch
Confirm merge from repo_sync_working_branch to main to sync with https://github.com/MicrosoftDocs/azure-docs (branch main)
2 parents 6bb6b0e + 67f4236 commit dea6847

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

articles/virtual-machines/vm-applications-how-to.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ VM Applications are a resource type in Azure Compute Gallery (formerly known as
2323
Before you get started, make sure you have the following:
2424

2525

26-
This article assumes you already have an Azure Compute Gallery. If you don't already have a gallery, create one first. To learn more, see [Create a gallery for storing and sharing resources](create-gallery.md)..
26+
This article assumes you already have an Azure Compute Gallery. If you don't already have a gallery, create one first. To learn more, see [Create a gallery for storing and sharing resources](create-gallery.md).
2727

2828
You should have uploaded your application to a container in an [Azure storage account](../storage/common/storage-account-create.md). Your application can be stored in a block or page blob. If you choose to use a page blob, you need to byte align the files before you upload them. Here's a sample that will byte align your file:
2929

@@ -151,8 +151,8 @@ Set a VM application to an existing VM using [az vm application set](/cli/azure/
151151
az vm application set \
152152
--resource-group myResourceGroup \
153153
--name myVM \
154-
--app-version-ids /subscriptions/{subID}/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/galleries/myGallery/applications/myApp/versions/1.0.0 \
155-
--treat-deployment-as-failure true
154+
--app-version-ids /subscriptions/{subID}/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/galleries/myGallery/applications/myApp/versions/1.0.0 \
155+
--treat-deployment-as-failure true
156156
```
157157
For setting multiple applications on a VM:
158158

@@ -165,14 +165,20 @@ az vm application set \
165165
```
166166
To add an application to a VMSS, use [az vmss application set](/cli/azure/vmss/application#az-vmss-application-set):
167167

168-
```azurepowershell-interactive
169-
az vmss application set -g myResourceGroup -n myVmss --app-version-ids /subscriptions/{subId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/applications/myApp/versions/1.0.0
170-
--treat-deployment-as-failure true
168+
```azurecli-interactive
169+
az vmss application set \
170+
--resource-group myResourceGroup \
171+
--name myVmss \
172+
--app-version-ids /subscriptions/{subId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/applications/myApp/versions/1.0.0 \
173+
--treat-deployment-as-failure true
171174
```
172175
To add multiple applications to a VMSS:
173176
```azurecli-interactive
174-
az vmss application set -g myResourceGroup -n myVmss --app-version-ids /subscriptions/{subId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/applications/myApp/versions/1.0.0 /subscriptions/{subId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/applications/myApp2/versions/1.0.0
175-
--treat-deployment-as-failure true
177+
az vmss application set \
178+
--resource-group myResourceGroup \
179+
--name myVmss
180+
--app-version-ids /subscriptions/{subId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/applications/myApp/versions/1.0.0 /subscriptions/{subId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/applications/myApp2/versions/1.0.0 \
181+
--treat-deployment-as-failure true
176182
```
177183

178184
To verify application VM deployment status, use [az vm get-instance-view](/cli/azure/vm/#az-vm-get-instance-view):
@@ -182,14 +188,14 @@ az vm get-instance-view -g myResourceGroup -n myVM --query "instanceView.extensi
182188
```
183189
To verify application VMSS deployment status, use [az vmss get-instance-view](/cli/azure/vmss/#az-vmss-get-instance-view):
184190

185-
```azurepowershell-interactive
191+
```azurecli-interactive
186192
az vmss get-instance-view --ids (az vmss list-instances -g myResourceGroup -n myVmss --query "[*].id" -o tsv) --query "[*].extensions[?name == 'VMAppExtension']"
187193
```
188194
> [!NOTE]
189195
> The above VMSS deployment status command does not list the instance ID with the result. To show the instance ID with the status of the extension in each instance, some additional scripting is required. Refer to the below VMSS CLI example that contains PowerShell syntax:
190196
191-
```azurecli-interactive
192-
$ids = az vmss list-instances -g myResourceGroup -n myVMss --query "[*].{id: id, instanceId: instanceId}" | ConvertFrom-Json
197+
```azurepowershell-interactive
198+
$ids = az vmss list-instances -g myResourceGroup -n myVmss --query "[*].{id: id, instanceId: instanceId}" | ConvertFrom-Json
193199
$ids | Foreach-Object {
194200
$iid = $_.instanceId
195201
Write-Output "instanceId: $iid"
@@ -247,28 +253,28 @@ $applicationName = "myApp"
247253
$version = "1.0.0"
248254
$vmName = "myVM"
249255
$vm = Get-AzVM -ResourceGroupName $rgname -Name $vmName
250-
$appversion = Get-AzGalleryApplicationVersion `
256+
$appVersion = Get-AzGalleryApplicationVersion `
251257
-GalleryApplicationName $applicationName `
252258
-GalleryName $galleryName `
253259
-Name $version `
254260
-ResourceGroupName $rgName
255-
$packageid = $appversion.Id
256-
$app = New-AzVmGalleryApplication -PackageReferenceId $packageid
261+
$packageId = $appVersion.Id
262+
$app = New-AzVmGalleryApplication -PackageReferenceId $packageId
257263
Add-AzVmGalleryApplication -VM $vm -GalleryApplication $app -TreatFailureAsDeploymentFailure true
258264
Update-AzVM -ResourceGroupName $rgName -VM $vm
259265
```
260266
To add the application to a VMSS:
261-
```azurecli-interactive
267+
```azurepowershell-interactive
262268
$vmss = Get-AzVmss -ResourceGroupName $rgname -Name $vmssName
263-
$appversion = Get-AzGalleryApplicationVersion `
269+
$appVersion = Get-AzGalleryApplicationVersion `
264270
-GalleryApplicationName $applicationName `
265271
-GalleryName $galleryName `
266272
-Name $version `
267273
-ResourceGroupName $rgName
268-
$packageid = $appversion.Id
269-
$app = New-AzVmssGalleryApplication -PackageReferenceId $packageid
274+
$packageId = $appVersion.Id
275+
$app = New-AzVmssGalleryApplication -PackageReferenceId $packageId
270276
Add-AzVmssGalleryApplication -VirtualMachineScaleSetVM $vmss.VirtualMachineProfile -GalleryApplication $app
271-
Update-AzVMss -ResourceGroupName $rgName -VirtualMachineScaleSet $vmss -VMScaleSetName $vmssName
277+
Update-AzVmss -ResourceGroupName $rgName -VirtualMachineScaleSet $vmss -VMScaleSetName $vmssName
272278
```
273279

274280

@@ -281,7 +287,7 @@ $result = Get-AzVM -ResourceGroupName $rgName -VMName $vmName -Status
281287
$result.Extensions | Where-Object {$_.Name -eq "VMAppExtension"} | ConvertTo-Json
282288
```
283289
To verify for VMSS:
284-
```powershell-interactive
290+
```azurepowershell-interactive
285291
$rgName = "myResourceGroup"
286292
$vmssName = "myVMss"
287293
$result = Get-AzVmssVM -ResourceGroupName $rgName -VMScaleSetName $vmssName -InstanceView
@@ -290,7 +296,7 @@ $result | ForEach-Object {
290296
$res = @{ instanceId = $_.InstanceId; vmappStatus = $_.InstanceView.Extensions | Where-Object {$_.Name -eq "VMAppExtension"}}
291297
$resultSummary.Add($res) | Out-Null
292298
}
293-
$resultSummary | convertto-json -depth 5
299+
$resultSummary | ConvertTo-Json -Depth 5
294300
```
295301

296302
### [REST](#tab/rest2)

0 commit comments

Comments
 (0)