none
How to create Azure Data Lake Analytics with script if Resource group and ADLS already exists

    Question

  • I would like to create Azure Data Lake Store, Azure Data Lake Analytics and then Azure Data Factory services with scripts. I'm got templates from https://github.com/Azure/azure-quickstart-templates. I can deploy first service fine, but next ones fails because resource group already exists.

    How to modify second deployment command so that it uses existing resources group instead of trying to create new resource group?

    Login-AzureRmAccount
    Select-AzureRmSubscription
    Select-AzureRmSubscription -SubscriptionName "My Subs Dev"

    New-AzureRmResourceGroup -Name MyProjectDev -Location "North Europe"

    New-AzureRmResourceGroupDeployment -Name MyProjectDev -ResourceGroupName MyProjectDev `
      -TemplateFile c:\ADLSDeployment\adlsdeploy.json `
      -TemplateParameterFile c:\ADLSDeployment\adlsdeploy.parameters.json

    Everything goes fine until here, but next command fails, because resource group already exists:

    New-AzureRmResourceGroupDeployment -Name MyProjectDev -ResourceGroupName MyProjectDev `
      -TemplateFile c:\ADLADeployment\adladeploy.json `
      -TemplateParameterFile c:\ADLADeployment\adladeploy.parameters.json



    Kenny_I

    Friday, December 15, 2017 11:20 AM

All replies

  • I'd be happy to help.  Using the script you have above, it's supposed to fail by design.  You'll need to insert a check to see if the resource exists first.  It will always fail if you try to create it and it already exists.

    Thank you,

    Guy

    Friday, December 15, 2017 4:21 PM
  • Thanks. Would it possible to modify this script so that it does not try to create resource group, but just resource.

    New-AzureRmResourceGroupDeployment -Name MyProjectDev -ResourceGroupName MyProjectDev `
      -TemplateFile c:\ADLADeployment\adladeploy.json `
      -TemplateParameterFile c:\ADLADeployment\adladeploy.parameters.json



    Kenny_I

    Friday, December 15, 2017 4:28 PM
  • Kenny, they are just templates.  You can modify your copy as much as you'd like.  You're also welcome to reply to the writer, Gabriel - but we've kind of split the issue across two forums (GitHub and MSDN).  if you really are suggesting Gabriel modify the example, a private message to him directly might be the best bet.

    Guy

    Wednesday, December 20, 2017 7:47 PM