Deploy Cloudera cluster on azure FAILED , JSON/ARM template issue - json

I m trying to install cloudera on azure using the link below https://github.com/Azure/azure-quickstart-templates/tree/master/cloudera-on-centos It gave me a few errors, below deploy cloudera on centos Required property 'resources' not found in JSON
I solved it. BUT I m now stuck at some point. "message": "Deployment template validation failed: 'The template 'copy' definition at line '0' and column '0' is missing a copy input value.
I use copy for resources, not for properties, there is no need for input value.
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[concat(variables('publicIPAddressName'), copyIndex())]",
"location": "[parameters('location')]",
"copy": [{
"name": "publicIPLoop",
"count": "[parameters('vmCount')]"
}],
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[concat(parameters('dnsNamePrefix'), '-dn', copyIndex())]"
}
}
}

copy should look like this:
"copy": {
"name": "publicIPLoop",
"count": "[parameters('vmCount')]"
},
its an object, not an array

THANKS A LOT for your response,
Initially there was no bracket , it gave me another error:
"message": "Deployment template validation failed: 'The template resource 'master-node' at line '493' and column '9' is not valid: The template function 'copyIndex' is not expected at this location. The function can only be used in a resource with copy specified. Please see https://aka.ms/arm-copy for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.'."
I googled it, and I saw the post
copyindex() error in arm template
I put the brackets, to make it an array, and now it asks me for input, which does not make sense, according to
https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-multiple

Related

Azure CLI Extensions: exported dashboard template.json "does not contain the property 'location'" error

I'm getting this error:
<_io.TextIOWrapper name='C:\\Users\\david\\source\\repos\\azurePortalInfrastruct\\ExportedTemplate-example-resources\\template.json' mode='r' encoding='cp1252'> does not contain the property 'location'
Which may be down to the way the template.json file has been put together.
My issue is similar to:
Azure CLI unable to create portal dashboards from templates
I followed this to a now closed github issue: Azure CLI unable to create portal dashboards from templates #16356
Following the advice from the developer. I used the following command (which generated the error):
az portal dashboard import --name "testDashboard" --resource-group "example-resources_copy" `
>> --input-path "C:\Users\david\source\repos\azurePortalInfrastruct\ExportedTemplate-example-resources\template.json"
The file template.json was exported from my portal. I have checked it. It has lines 13-16:
"type": "Microsoft.Portal/dashboards",
"apiVersion": "2020-09-01-preview",
"name": "[parameters('dashboards_a9dc12e1_3aae_431d_b935_81dd5ea20bd8_dashboard_name')]",
"location": "westus",
Regarding a similar command the developer has said:
In az portal dashboard create, the --input-path is the path to properties json file instead of full template.
My export from portal dashboard consisted of two files.
template.json
parameters.json
The file template.json contains a properties section on line 20 (which follows the location line 16) But I didn't get a separate properties.json file in my export.
The developer goes on to say:
If you want to create a dashboard with full template, should use the command az portal dashboard import. Also, you need to update the location value in your sample Json.
I can get it working with the sample json code sample used for the github issue #16356
{
"properties": {
"lenses": {
"0": {
"order": 0,
"parts": {}
}
},
"metadata": {
"model": {
"timeRange": {
"value": {
"relative": {
"duration": 24,
"timeUnit": 1
}
},
"type": "MsPortalFx.Composition.Configuration.ValueTypes.TimeRange"
}
}
}
},
"name": "TestDashboard",
"type": "Microsoft.Portal/dashboards",
"location": "westus",
"tags": {
"hidden-title": "My Test Dashboard"
},
"apiVersion": "2015-08-01-preview"
}
But this is sample is nothing like the JSON ARM code I exported from my existing Azure Portal dashboard.
Any suggestions appreciated.

Executing a specific http method 'depending' on the condition given in the JSON file

I was thinking about the possibility of executing a specific http method (POST or PUT) in POSTMAN without specifying it.
I mean; imagine if there was a field in a JSON file called: METHOD within 2 possible states: 'I' corresponding to INSERT OR POST and the another one: 'U' related to UPDATE or PUT
Something like this: (please, do note the field called "method"):
[
{
"sku": "95LB645R34ER",
"method": 'I'
"payload": {
"price": "147000",
"tax_percentage": "US-21",
"store_code": "B2BUSD",
"markup_top": "1.62",
"status": "1",
"group_prices": [
{
"group": "CLASS A",
"price": "700038.79",
"website": "B2BUSD"
}
]
}
},
{
"sku": "95TYS34344ER",
"method": 'U'
"payload": {
"price": "69978",
"tax_percentage": "US-21",
"store_code": "B2BUSD",
"markup_top": "9.99",
"status": "1",
"group_prices": [
{
"group": "CLASS B",
"price": "88888.79",
"website": "B2BUSD"
}
]
}
}
]
I would like to run that JSON using the Collection Runner but i have no idea how to do the trick. I mean, everytime i generate a collection i have to specify the HTTP METHOD otherwise it wont know what to do.
I want the program to adjust that by looking at the JSON file, if "method":'I' then, perform a POST or if "method":'U' execute a PUT method. Do you get me?
I've been reading the documentation but i did not find something like that or maybe i did not understand. I'm not an expert on POSTMAN :(
Can you help me?
EDIT:
Alright, i did this:
In the request UI, use the {{METHOD}} syntax where you would see the HTTP method. This is an editable field as it allows you to add custom HTTP methods.
In the file, use the METHOD key and any HTTP verb as the value. Ensure that it's part of each object in the datafile as you will need it for each iteration.

How can I retrieve the query key for Bing Maps API for Enterprise in an Azure Resource Group Template?

I am working on an ARM template that deploys an entire infrastructure from scratch:
The resource group
App Service plans
Application Insights
an so forth...
At some point I get to the part where I write the scripts for deploying my App Service (for hosting and deploying my web app later on) to my resource group. Prior to that I have my BingMaps API deployed in the same script.
I am stuck at the part where I am setting the Application Settings for my web app:
"type": "Microsoft.Web/sites",
"properties": {
"siteConfig": {
"appSettings": [
{
"name": "SomeKey",
"value": "SomeValue"
}, //rest of the code omitted
I would like to know how could I retrieve my BING MAPS query key within an ARM template?
I have tried, and have a feeling that this might be close to it, something like:
"value": "[reference(resourceId('Microsoft.BingMaps/mapApis', variables('bingMapsName')), '2016-08-18').queryKey]"
Anybody who has done this before? Many thanks in advance! Cheers
If you want to access query key in your ARM template for your web app setting, I would suggest you to use something like below:
{
"name": "appsettings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('webSiteName'))]"
],
"tags": {
"displayName": "WebAppSettings"
},
"properties": {
"key1": "[parameter('AppSetting_Key1_Value')]",
"key2": "value2"
}
}
and then in your template.Parmeter.jso file , you can declare the key AppSetting_Key1_Value with the value of your Bing maps query key.
Specify the Parameter Value
After the Parameter has been added to the ARM Template and it’s being used to populate an Application Setting, the final step is to define the Parameter value within the ARM Templates Parameter file used for deployments. In the Azure Resource Group project template in Visual Studio the Parameters file for the default deployment is the file that ends with “.parameters.json”.
Here’s a screenshot of the “WebSite.parameters.json” file created in the previous articles in this series with the “AppSetting_Key1_Value” Parameter set to a value:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"hostingPlanName": {
"value": "WebApp1HostingPlan"
},
"WebApplication1PackageFolder": {
"value": "WebApplication1"
},
"WebApplication1PackageFileName": {
"value": "package.zip"
},
"WebApp_ConnString1": {
"value": "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"
},
"AppSetting_Key1_Value": {
"value": "Template Value 1"
}
}
}
for security complaint solution , you can move all your secure key and connection string to Azure key vault if you are not comfortable to have keys in param file.
This should work. Hope it helps.

Can't create image from tar.gz file in bucket

I'm trying to create a custom image using Console or gcloud, i.e. (Note: URLs are masked with [naURL] to get around URL posting limitation.):
$ gcloud compute images create debian-9-1-v20170810-1 --source-uri=https:[naURL]//storage.googleapis.com/[my bucket]/compressed-image.tar.gz
The command runs for about half an hour (i.e. 1800s) and then gives the following error:
ERROR: (gcloud.compute.images.create) Could not fetch resource:
- Did not create the following resources within 1800s: https:[naURL]//www.googleapis.com/compute/v1/projects/spherical-proxy-175708/global/images/debian-9-1-v20170810-1. These operations may still be underway remotely and may still succeed; use gcloud list and describe commands or https:[naURL]//console.developers.google.com/ to check resource state
The corresponding REST record accessible via Console>Compute Engine>Operations for the item reads:
{
"kind": "compute#operation",
"id": "5371669110648613089",
"name": "operation-1502320142020-5565a2a676da1-06d76920-4c86568d",
"operationType": "insert",
"targetLink": "https:[naURL]//www.googleapis.com/compute/v1/projects/spherical-proxy-175708/global/images/debian-9-1-v20170810-1",
"targetId": "3098231522309056737",
"status": "DONE",
"user": "andree.leidenfrost#gmail.com",
"progress": 100,
"insertTime": "2017-08-09T16:09:02.501-07:00",
"startTime": "2017-08-09T16:09:03.136-07:00",
"endTime": "2017-08-09T16:59:29.128-07:00",
"error": {
"errors": [
{
"code": "INTERNAL_ERROR",
"message": "Code: '8625676013601614622'"
}
]
},
"httpErrorStatusCode": 503,
"httpErrorMessage": "SERVICE UNAVAILABLE",
"selfLink": "https:[naURL]//www.googleapis.com/compute/v1/projects/spherical-proxy-175708/global/operations/operation-1502320142020-5565a2a676da1-06d76920-4c86568d"
}
Because the HTTP error is 503 "SERVICE UNAVAILABLE" I've tried a few times over the last couple of days but the problem persists.
I'm trying to follow the instructions in document Importing Boot Disk Images to Compute Engine.
Any help or hints how to debug further would be greatly appreciated!

Cloudformation error: "Template validation error: Invalid template parameter property 'VPC'"

I got big cloudformation json template, and trying to add VPC to it.
When I added VPC I got this error:
Template validation error: Invalid template parameter property 'VPC'
Here the where I use VPC in Resource:
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "String",
"EnableDnsSupport": true,
"EnableDnsHostnames": true,
"Tags": [
{"Key": "Name", "Value": {"Fn::Join": ["", [{"Ref": "Env"}, "-VPC"]]}, "PropagateAtLaunch": true}
]
}
}
And I use "VpcId": {"Ref": "VPC"} in Loadbalancers, SecurityGroups PrivateSubnet, PublicSubnet in properties.
Here is VpcId in Parameters:
"VpcId" : {
"Type" : "String",
"Description" : "VpcId of your existing Virtual Private Cloud (VPC)."
}
I'm not doing something very special here, but still little bit confused about error output of create stack with cloudformation.
Who can told me, what I'm doing wrong here?
Here is whole template link (without important credentials).
Thanks!
Looks like you need to close the "Parameters" block before the "Resources" block so CFN tries to create a parameter called "Resources" with a property "VPC"
Based on the template it looks like everything should be working fine. Are you still getting the same issue?