Akshay
Akshay

Reputation: 117

Do ARM templates provide a way to capture the logs during creation of resources

we have ARM template which creates the azure resources. While we run the powershell script which created the resources, we want to log all the info.

we want to know if any logging functionality which azure ARM template provides

the list of resources we are as follows : - storage account - automation account - key-vault - Sql server pool - functionApp etc

Upvotes: 1

Views: 1478

Answers (2)

bit
bit

Reputation: 4487

Below are some of the general configurations you can use for the New-AzureRmResourceGroupDeployment to get the most amount of logging from the command. You may lookup the equivalent AZ cmdlet, if you need to.

You can use the -Verbose and -DeploymentDebugLogLevel All parameters to get some more logging info. Note that the Deployment debug parameter will cause a warning to show up in your console output stream.

You can use the -ErrorVariable ErrorMessages parameter to get the error messages and then use them appropriately in your script.

Lastly, you can use the JSON output of the cmdlet to get some insights, if any.

Below is how the cmldet typically looks like for me..

$jsonOutput = New-AzureRmResourceGroupDeployment -Name  $DeploymentName `
        -ResourceGroupName $ResourceGroupName `
        -TemplateFile $TemplateFileToDeploy `
        -TemplateParameterObject $TemplateParameters `
        -Force -Verbose `
        -ErrorVariable ErrorMessages -DeploymentDebugLogLevel All

Upvotes: 2

4c74356b41
4c74356b41

Reputation: 72181

closest you can get is launch new-azresourcegroupdeployment with the -verbose switch, that would give you some idea whats going on, but I dont really think you are interested in that, you are mostly interested in errors. Fairly certain new-azresourcegroupdeployment outputs those.

Upvotes: 0

Related Questions