Getting below error while deploying ARM template. Please advise.
Exception :com.microsoft.azure.CloudException: 400 is not a valid polling status code: The request content was invalid and could not be deserialized: 'Error converting value "{"adminUsername":{"value":"azureuser"},"dnsLabelPrefix":{"value":"aademo"},"vmSize":{"value":"Standard_D1"},"adminPassword":{"value":"azAdm1n"}}" to type 'System.Collections.Generic.Dictionary`2[System.String,Microsoft.WindowsAzure.ResourceStack.Frontdoor.Data.Definitions.DeploymentParameterDefinition]'. Path 'properties.parameters', line 1, position 363.'.
Below is the code snippet
String resourceGroupName = "aaTestRG";
String location = "westus";
//Create Resource Group
ResourceGroup rGroup = new ResourceGroup();
rGroup.setLocation(location);
ServiceResponse<ResourceGroup> response = null;
if (armClient.getResourceGroupsOperations().checkExistence(resourceGroupName).getBody()) {
response = armClient.getResourceGroupsOperations().createOrUpdate(resourceGroupName, rGroup);
}
while (!armClient.getResourceGroupsOperations().checkExistence(resourceGroupName).getBody()) {
Thread.sleep(5000);
}
String TEMPLATE_URI = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/multichain-on-ubuntu/azuredeploy.json";
String TEMPLATE_VER = "1.0.0.0";
Map<String, ParameterValue> parameters = new HashMap<String, ParameterValue>();
parameters.put("dnsLabelPrefix", new ParameterValue("aademo"));
parameters.put("adminUsername", new ParameterValue("azureuser"));
parameters.put("adminPassword", new ParameterValue("azAdm1n"));
parameters.put("vmSize", new ParameterValue("Standard_D1"));
final String parametersJson = new Gson().toJson(parameters);
DeploymentProperties deploymentProperties = new DeploymentProperties();
deploymentProperties.setMode(DeploymentMode.INCREMENTAL);
TemplateLink templateLink = new TemplateLink();
templateLink.setUri(TEMPLATE_URI);
templateLink.setContentVersion(TEMPLATE_VER);
deploymentProperties.setTemplateLink(templateLink);
deploymentProperties.setParameters(parametersJson);
Deployment deployment = new Deployment();
deployment.setProperties(deploymentProperties);
ServiceResponse<DeploymentExtended> deployResponse = armClient.getDeploymentsOperations().createOrUpdate(resourceGroupName, "aaDeployment", deployment);
if (!deployResponse.getResponse().isSuccess()) {
String errMsg = "Error while deplying template " + TEMPLATE_URI + ". Deployment Result: " + deployResponse.getResponse().message();
System.out.println("Error :" + deployResponse.getResponse().message());
throw new CloudException(errMsg);
}
Getting below error while deploying ARM template. Please advise.
Exception :com.microsoft.azure.CloudException: 400 is not a valid polling status code: The request content was invalid and could not be deserialized: 'Error converting value "{"adminUsername":{"value":"azureuser"},"dnsLabelPrefix":{"value":"aademo"},"vmSize":{"value":"Standard_D1"},"adminPassword":{"value":"azAdm1n"}}" to type 'System.Collections.Generic.Dictionary`2[System.String,Microsoft.WindowsAzure.ResourceStack.Frontdoor.Data.Definitions.DeploymentParameterDefinition]'. Path 'properties.parameters', line 1, position 363.'.
Below is the code snippet