download Azure Service Configuration (.cscfg) through Powershell cmdlet Get-AzureRMDeployment

567 views Asked by At

I am trying to download service configuration (.cscfg) from a Cloud service using the below command powershell command. but unfortunately getting an error.

Get-AzureRmDeployment -Name "xxxx"
Get-AzureRmDeployment : Deployment 'xxxx' could not be found.

I have selected the correct subscription passed the corrected deployment name but still getting this error.

I tried to get all the deployments on this subscription using the below command, the command returned nothing, not even an erro.

Get-AzureRmDeployment

Earlier I used Get-AzureDeployment on the classic subscription to get .cscfg, and it used to work perfectly fine on RM the above commands are not working.

Can somebody help me figuring out on how to get the service configuration, using powershell...?

snipet of the command.

PS C:\WINDOWS\system32> Get-AzureRmDeployment -Name "xxxx"
Get-AzureRmDeployment : Deployment 'xxxx' could not be found.
At line:1 char:1
+ Get-AzureRmDeployment -Name "xxxx"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzureRmDeployment], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureDeploymentCmdlet
2

There are 2 answers

0
Joy Wang On BEST ANSWER

The Cloud Service is deployed as classic(ASM), you could not get the deployment via Get-AzureRMDeployment.

If you want to get Configuration (.cscfg) via ARM powershell, you could use Get-AzureRmResource to get it.

$slot = Get-AzureRmResource -ResourceGroupName <ResourceGroupName> -ResourceType Microsoft.ClassicCompute/domainNames/slots -ResourceName "xxxxx" -ApiVersion 2016-04-01
$slot.Properties.configuration
1
CHEEKATLAPRADEEP On

Note: This functionality is not available in ARM cmdlets.

Azure Cloud Services uses Azure Service Management PowerShell Module.

Get-AzureDeployment cmdlet gets details of an Azure classic (ASM) deployment. Since you are using Cloud Services it gives the output.

Get-AzureRMDeployment cmdlet gets details of Azure Resource Manager (ARM) deployment.

Since you are using Cloud Service it doesn’t gives the output because Azure Cloud Services uses ASM module not ARM module.