An Azure resource group was initially deployed from an Azure Resource Manager (ARM) template. Resources have since been added and modified manually through the Azure portal.
You need to create a new template based on the current state of the resource group.
Which PowerShell cmdlet should you use?
You should use the Export-AzResourceGroup cmdlet. This cmdlet captures a specified resource group and saves it as a template to a JSON file. This gives you a way to create a template based on the current resources in a resource group. You also have the option of exporting a running resource group as a template from the Azure portal.
You should not use the Save-AzResourceGroupDeploymentTemplate cmdlet. This saves a resource group deployment, not the current resource group, to a file. You must specify both the deployment name and resource group name.
You should not use the Save-AzDeploymentTemplate cmdlet. This saves an existing deployment template to a new template file.
You should not use the New-AzResourceGroupDeployment cmdlet. This cmdlet is used to apply a template to an existing resource group, not to create a new template file.