Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM templete issue #1

Open
sarojgouda opened this issue Sep 18, 2017 · 0 comments
Open

ARM templete issue #1

sarojgouda opened this issue Sep 18, 2017 · 0 comments

Comments

@sarojgouda
Copy link

Hi @ravbhatnagar , i created VM creation script but every time it promoting for input , like hostname , virtual network
this is my azuredeployed.jsom
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.2",
"parameters": {
"hostnames": {
"type": "string"
},
"location": {
"type": "string",
"allowedValues": [
"North Europe",
"West Europe"
],
"metadata": {
"description": "Location for the VM"
}
},
"virtualNetwork": {
"type": "string",
"metadata": {
"description": "Virtual Network"
}
},
"virtualNetworkResourceGroup": {
"type": "string",
"metadata": {
"description": "Resource group where to virtual network is found"
}
},
"subnet": {
"type": "string",
"metadata": {
"description": "Subnet"
}
},
"storageAccount": {
"type": "string",
"metadata": {
"description": "Storage account for VM"
}
},
"sizeOfInstance": {
"type": "string",
"allowedValues": [
"Standard_A0",
"Standard_A1",
"Standard_A2",
"Standard_A3",
"Standard_A4"
],
"defaultValue": "Standard_A3",
"metadata": {
"description": "Size for all deployed vms"
}
},
"diskSize": {
"type": "int",
"defaultValue": 300,
"metadata": {
"description": "Size for Datadisk0"
}
},
"sshUser": {
"type": "string",
"metadata": {
"description": "Admin SSH user"
}
},
"sshPassword": {
"type": "secureString",
"metadata": {
"description": "Password for SSH access"
}
},
"chefRunlist": {
"type": "string",
"defaultValue": "recipe[eon_base]",
"metadata": {
"description": "Chef runlist"
}
},
"chefServerUrl": {
"type": "string",
"metadata": {
"description": "Chef server url"
}
},
"chefValidationClientName": {
"type": "string",
"metadata": {
"description": "Chef Client validation name"
}
},
"chefValidationKey": {
"type": "secureString",
"metadata": {
"description": "Chef Client Validation.PEM as single line"
}
},
"chefEnvironment": {
"type": "string",
"metadata": {
"description": "Chef Environment"
}
},
"chefEncryptedDataBagSecret": {
"type": "secureString",
"metadata": {
"description": "Chef Encrypted Data Bag Secret"
}
},
"customScriptStorageAccount": {
"type": "string",
"metadata": {
"description": "Storage Account where your script is stored"
}
},
"customScriptStorageAccountKey": {
"type": "secureString",
"metadata": {
"description": "Access key for storage account where your script is stored"
}
},
"customScriptCommand": {
"type": "string",
"metadata": {
"description": "Command to execute with your custom script .. bash whatever.sh"
}
},
"customScriptFileUri": {
"type": "string",
"metadata": {
"description": "Uri where to find the custom script"
}
}
},
"variables": {
"subnet": "[parameters('subnet')]",
"imagePublisher": "OpenLogic",
"imageOffer": "CentOS",
"imageSKU": "7.1",
"vmName": "[parameters('hostnames')]",
"virtualNetworkName": "[parameters('virtualNetwork')]",
"vnetRg": "[parameters('virtualNetworkResourceGroup')]",
"vnetID": "[resourceId(variables('vnetRg'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/', variables('subnet'))]"
},
"resources": [{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('storageAccount')]",
"apiVersion": "2015-05-01-preview",
"location": "[parameters('location')]",
"properties": {
"accountType": "Standard_LRS"
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"names": "[concat('nic', parameters('hostnames'))]",
"location": "[parameters('location')]",
"properties": {
"ipConfigurations": [{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}]
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/virtualMachines",
"names": "[parameters('hostnames')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', 'nic', parameters('hostnames'))]",
"[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccount'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('sizeOfInstance')]"
},
"osProfile": {
"computerName": "[parameters('hostnames')]",
"adminUsername": "[parameters('sshUser')]",
"adminPassword": "[parameters('sshPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSKU')]",
"version": "latest"
},
"osDisk": {
"name": "osdisk",
"vhd": {
"uri": "[concat('http://',parameters('storageAccount'),'.blob.core.windows.net/vhds/','osdisk', parameters('hostnames'), '.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
},
"dataDisks": [{
"name": "datadisk0",
"diskSizeGB": "[parameters('diskSize')]",
"lun": 0,
"vhd": {
"uri": "[concat('http://',parameters('storageAccount'),'.blob.core.windows.net/vhds/','datadisk', parameters('hostnames'), '-data0','.vhd')]"
},
"createOption": "Empty"
},
{
"name": "datadisk1",
"diskSizeGB": "[parameters('diskSize')]",
"lun": 1,
"vhd": {
"uri": "[concat('http://',parameters('storageAccount'),'.blob.core.windows.net/vhds/','datadisk', parameters('hostnames'), '-data1','.vhd')]"
},
"createOption": "Empty"
}
]
},
"networkProfile": {
"networkInterfaces": [{
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat('nic', parameters('hostnames')))]"
}]
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/installcustomscript')]",
"apiVersion": "2015-05-01-preview",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
],
"properties": {
"publisher": "Microsoft.OSTCExtensions",
"type": "CustomScriptForLinux",
"typeHandlerVersion": "1.4",
"settings": {
"fileUris": ["[parameters('customScriptFileUri')]"],
"commandToExecute": "[parameters('customScriptCommand')]"
},
"protectedSettings": {
"storageAccountName": "[parameters('customScriptStorageAccount')]",
"storageAccountKey": "[parameters('customScriptStorageAccountKey')]"
}
}
}
]
}

this is my azure.parameter.json
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"hostnames": {
"value": "test"
},
"location": {
"value": ""
},
"virtualNetwork": {
"value": ""
},
"virtualNetworkResourceGroup": {
"value": ""
},
"subnet": {
"value": ""
},
"storageAccount": {
"value": "test"
},
"sizeOfInstance": {
"value": "Standard_A1"
},
"diskSize": {
"value": 500
},
"sshUser": {
"value": ""
},
"sshPassword": {
"value": ""
},
"chefRunlist": {
"value": ""
},
"chefServerUrl": {
"value": ""
},
"chefValidationClientName": {
"value": ""
"
},
"chefValidationKey": {
"value": ""
},
"chefEnvironment": {
"value": "_default"
},
"chefEncryptedDataBagSecret" : {
"value": ""
},
"customScriptStorageAccount": {
"value": ""
},
"customScriptStorageAccountKey": {
"value": ""
},
"customScriptCommand": {
"value": ""
},
"customScriptFileUri": {
"value": ""
}
}
}

this is my power shell script

LOGIN

#Login-AzureRmAccount

SET SUBSCRIPTION

Set-AzureRmContext -SubscriptionId ""

SET LOCATION

$LOCATION = "West Europe"

SET A NICE NAME FOR YOUR DEPLOYMENT

$DEPLOYMENT_NAME = ""

SET RESOURCE GROUP

$RESOURCE_GROUP = ""

SET PATH TO YOUR TEMPLATES

$TEMPLATE_FILE = ""
$PARAMETER_FILE = ""

New-AzureRmResourceGroup -Name $RESOURCE_GROUP -Location $LOCATION
New-AzureRmResourceGroupDeployment -Name $DEPLOYMENT_NAME -ResourceGroupName $RESOURCE_GROUP -TemplateFile $TEMPLATE_FILE -TemplateParameterFile $PARAMETER_FILE -Force

please help me on that , thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant