0
votes

In Azure Powershell, I'm working with the new Az module that has replaced the AzureRM module. I want to set the deployment mode to Complete, but I don't see how that is done.

Caution for readers: The PowerShell 'Az' module has no relationship to the 'az' command of the Azure CLI.

I've tried this:

PS C:\repos\azure\pdi> New-AzDeployment -Name bjaDeploy -Location southcentralus -Mode Complete -TemplateParameterFile t
est.parameters.json -TemplateFile testrg.json
New-AzDeployment : A parameter cannot be found that matches parameter name 'Mode'.
At line:1 char:59
+ ... w-AzDeployment -Name bjaDeploy -Location southcentralus -Mode Complet ...
+                                                             ~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-AzDeployment], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.N
ewAzureDeploymentCmdlet

Not surprisingly, Get-Help New-AzDeployment shows the command-line switches, and none of them include Mode.

I've also tried placing the deployment mode directly into the ARM template:

"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {
    "rgName": {
        "type": "string"
    },
    "rgLocation": {
        "type": "string"
    }
},
"variables": {},
"resources": [
    {
        "type": "Microsoft.Resources/resourceGroups",
        "apiVersion": "2018-05-01",
        "location": "[parameters('rgLocation')]",
        "name": "[parameters('rgName')]",
        "properties": {
            "mode": "Complete"
        }
    }
],
"outputs": {}

The intellisense within Visual Studio Code tells me it is illegal to have a "mode" property and, sure enough, it gives an error when I attempt to deploy this. So it is not clear how to do this from the command prompt and it is unclear why it is not an option in the ARM template itself.

Any ideas? I need an answer specific to the 'Az' module. I do not intend on using the now deprecated AzureRM.

1

1 Answers

0
votes

I suppose you are looking for New-AzResourceGroupDeployment, it has the -Mode parameter.

The New-AzDeployment is migrated from New-AzureRmDeployment which also not have the -Mode parameter, if you used to use AzureRM powershell to do that, I suppose it maybe New-AzureRmResourceGroupDeployment.