title: Azure Powershell Script is ignoring defaultValue
body: <p>I am using PowerShell ISE to recreate an existing database using the script generated in the Azure Portal for the resource. I discovered that PS, does not use the script path, so I added these lines at the top:</p>
  
  <pre><code>Write-Host $PSScriptRoot
  Push-Location $PSScriptRoot
  Write-Host "Path: $(get-location)"
  </code></pre>
  
  <p>I added some testing code to make sure the template.json and parameters.json are present and that is working:</p>
  
  <pre><code># Start the deployment
  Write-Host "Starting deployment...";
  Write-Host "Testing: $templateFilePath"
  if(Test-Path $templateFilePath) {
      Write-Host "FOUND: $templateFilePath"
  
      if(Test-Path $parametersFilePath) {
          Write-Host "FOUND: $parametersFilePath"
          New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath;
      } else {
          New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath;
      }
  
  }
  </code></pre>
  
  <p>However, the script is still ignoring the defaultValue parameters in template.json:</p>
  
  <pre><code>"advisors_DropIndex_name": {
      "defaultValue": "DropIndex",
      "type": "String"
  },
  </code></pre>
  
  <p>parameters.json:</p>
  
  <pre><code>"advisors_DropIndex_name": {
      "value": null
  },
  </code></pre>
  
  <p>The script returns the following:</p>
  
  <p><em>New-AzureRmResourceGroupDeployment : 5:17:30 PM - Error: Code=InvalidDeploymentParameterValue; Message=The value of deployment parameter '<strong>keys_ServiceManaged_name</strong>' is null. Please specify 
  the value or use the parameter reference. See <a href="https://aka.ms/arm-deploy/#parameter-file" rel="nofollow noreferrer">https://aka.ms/arm-deploy/#parameter-file</a> for details.
  At C:\Users\longoj\Downloads\ExportedTemplate-DEEAResourceGroup\deploy.ps1:110 char:9
  +         New-AzureRmResourceGroupDeployment -ResourceGroupName $resour ...
  +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet</em></p>
  
  <p>If set the value in parameters.json:</p>
  
  <pre><code>"advisors_DropIndex_name": {
      "value": "DropIndex"
  },
  </code></pre>
  
  <p>the script validation moves on to the next parameter, and there are a lot of them. So it looks like the template.json file's defaultvalue parameter is being ignored.</p>
  
  <p>I am using: </p>
  
  <pre><code>Version           : 5.1.2
  Name              : Azure
  Author            : Microsoft Corporation
  PowerShellVersion : 3.0
  </code></pre>
  
  <p>What am I doing wrong ?</p>