You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.2 KiB

7 years ago
  1. @echo off
  2. if %1.==. GOTO error
  3. if %2.==. GOTO error
  4. if NOT %3.==-c. GOTO deployresources
  5. if %4.==. GOTO error
  6. echo Creating resource group %2 in '%4'
  7. call az group create --name %2 --location %4
  8. :deployresources
  9. echo Deploying ARM template '%1.json' in resource group %2
  10. call az group deployment create --resource-group %2 --parameters @%1.parameters.json --template-file %1.json
  11. GOTO end
  12. :error
  13. echo.
  14. echo Usage:
  15. echo create-resources arm-file resource-group-name [-c location]
  16. echo arm-file: Path to ARM template WITHOUT .json extension. An parameter file with same name plus '.parameters' MUST exist in same folde
  17. echo resource-grop-name: Name of the resource group to use or create
  18. echo -c: If appears means that resource group must be created. If -c is specified, must use enter location
  19. echo.
  20. echo Examples:
  21. echo create-resources path_and_filename testgroup (Deploys path_and_filename.json with parameters specified in path_and_filename.parameters.json file).
  22. echo create-resources path_and_filename newgroup -c westus (Deploys path_and_filename.json (with parameters specified in path_and_filename.parameters.json file) in a NEW resource group named newgroup in the westus location)
  23. :end