Skip to content

Commit 5cca4ae

Browse files
committed
Add VmExtension ps API calls - addressing CR
1 parent 1bb3f29 commit 5cca4ae

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

ComputeAdmin/AzureStack.ComputeAdmin.psm1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ Function Add-VMImage{
156156
$uri = $armEndpoint + '/subscriptions/' + $subscription + '/providers/Microsoft.Compute.Admin/locations/' + $location + '/artifactTypes/platformImage/publishers/' + $publisher
157157
$uri = $uri + '/offers/' + $offer + '/skus/' + $sku + '/versions/' + $version + '?api-version=2015-12-01-preview'
158158

159+
Log-Info $uri
159160

160161
#building platform image JSON
161162

@@ -327,6 +328,8 @@ Function Remove-VMImage{
327328
$uri = $armEndpoint + '/subscriptions/' + $subscription + '/providers/Microsoft.Compute.Admin/locations/' + $location + '/artifactTypes/platformImage/publishers/' + $publisher
328329
$uri = $uri + '/offers/' + $offer + '/skus/' + $sku + '/versions/' + $version + '?api-version=2015-12-01-preview'
329330

331+
Log-Info $uri
332+
330333
try{
331334
Invoke-RestMethod -Method DELETE -Uri $uri -ContentType 'application/json' -Headers $headers
332335
}
@@ -697,11 +700,11 @@ Function Add-VMExtension{
697700

698701
[Parameter(ParameterSetName='VMExtensionFromLocal')]
699702
[Parameter(ParameterSetName='VMExtesionFromAzure')]
700-
[String] $vmScaleSetEnabled = "false",
703+
[bool] $vmScaleSetEnabled = $false,
701704

702705
[Parameter(ParameterSetName='VMExtensionFromLocal')]
703706
[Parameter(ParameterSetName='VMExtesionFromAzure')]
704-
[String] $supportMultipleExtensions = "false",
707+
[bool] $supportMultipleExtensions = $false,
705708

706709
[Parameter(Mandatory=$true, ParameterSetName='VMExtensionFromLocal')]
707710
[Parameter(Mandatory=$true, ParameterSetName='VMExtesionFromAzure')]
@@ -758,6 +761,8 @@ Function Add-VMExtension{
758761
$uri = $armEndpoint + '/subscriptions/' + $subscription + '/providers/Microsoft.Compute.Admin/locations/' + $location + '/artifactTypes/VMExtension/publishers/' + $publisher
759762
$uri = $uri + '/types/' + $type + '/versions/' + $version + '?api-version=2015-12-01-preview'
760763

764+
Log-Info $uri
765+
761766
#building request body JSON
762767
if($pscmdlet.ParameterSetName -eq "VMExtensionFromLocal") {
763768
$sourceBlobJSON = '"SourceBlob" : {"Uri" :"' + $extensionBlobURIFromLocal + '"}'
@@ -786,7 +791,7 @@ Function Add-VMExtension{
786791
{
787792
if($extensionHandler.Properties.ProvisioningState -eq 'Failed')
788793
{
789-
Write-Error -Message "VM extension download failed." -ErrorAction Stop
794+
Write-Error -Message ('VM extension download failed with Error:"{0}.' -f $publisher, $_.Exception.Message ) -ErrorAction Stop
790795
}
791796

792797
if($extensionHandler.Properties.ProvisioningState -eq 'Canceled')
@@ -837,10 +842,12 @@ Function Remove-VMExtension{
837842
$uri = $armEndpoint + '/subscriptions/' + $subscription + '/providers/Microsoft.Compute.Admin/locations/' + $location + '/artifactTypes/VMExtension/publishers/' + $publisher
838843
$uri = $uri + '/types/' + $type + '/versions/' + $version + '?api-version=2015-12-01-preview'
839844

845+
Log-Info $uri
846+
840847
try{
841848
Invoke-RestMethod -Method DELETE -Uri $uri -ContentType 'application/json' -Headers $headers
842849
}
843850
catch{
844-
Write-Error -Message ('Deletion of VM extension with publisher "{0}" failed with Error:"{1}.' -f $publisher,$Error) -ErrorAction Stop
851+
Write-Error -Message ('Deletion of VM extension with publisher "{0}" failed with Error:"{1}.' -f $publisher, $_.Exception.Message ) -ErrorAction Stop
845852
}
846853
}

0 commit comments

Comments
 (0)