question

ThiyaguRajendran-6719 avatar image
0 Votes"
ThiyaguRajendran-6719 asked srbose-msft commented

How to deploy ARM template using url with params

I need to deploy a AKS using ARM template with a url. I guess it is possible using a url prefixed with https://portal.azure.com/#create/Microsoft.Template/uri/ followed by the location to the template url encoded.

Is it possible to pass parameters in the url to override the template parameters?

azure-kubernetes-service
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

srbose-msft avatar image
0 Votes"
srbose-msft answered srbose-msft commented

@ThiyaguRajendran-6719 , thank you for your question.

You can follow the steps to Deploy with the REST API

You can define a parameters file and provide the link in the Request Body like:

 {
  "properties": {
    "templateLink": {
      "uri": "<template-link>",
      "contentVersion": "<content-version>"
    },
    "parametersLink": {
      "uri": "<parameter-file-link>",
      "contentVersion": "<content-version>"
    },
    ...
  }
 }

or

pass parameters directly in the Request Body like:

 {
  "properties": {
    "templateLink": {
      "uri": "<template-link>",
      "contentVersion": "<content-version>"
    },
    "parameters": {
      ...
    },
    ...
  }
 }

For more information on creating Azure Resource Manager parameter files please check here.

Parameter precedence

You can use inline parameters and a local parameter file in the same deployment operation. For example, you can specify some values in the local parameter file and add other values inline during deployment. If you provide values for a parameter in both the local parameter file and inline, the inline value takes precedence.

It's possible to use an external parameter file, by providing the URI to the file. When you use an external parameter file, you can't pass other values either inline or from a local file. All inline parameters are ignored. Provide all parameter values in the external file.


Hope this helps.

Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@srbose-msft Thanks for replying

The problem I am trying to solve is that we want to provide customer a button (like Deploy to azure button) which will redirect to the azure portal from our site with template parameters filled specific for the customer. Other parameters can come from the template parameters file.

I guess REST API method will not be suitable for this problem.

Can you suggest if there are any alternate methods?

Thanks

0 Votes 0 ·
srbose-msft avatar image srbose-msft ThiyaguRajendran-6719 ·

@ThiyaguRajendran-6719 , in fact the main template can remain static as well, if your solution can accomodate for creating a parameters file for it dynamically with the same relative path.

For more information on Linked Azure Resource Manager Templates, please check here.

1 Vote 1 ·
srbose-msft avatar image srbose-msft ThiyaguRajendran-6719 ·

@ThiyaguRajendran-6719 , thank you for your response.

At the time of writing, the feature to specify a parameters file or inline parameters with the Azure Resource Manager Template deployment URL is not available.

Instead, the closest solution would be to have a static template which contains constant parameters and the resources block and a main dynamic template (which uses the static template as a linked template) to be created every time based on the user's specific parameter values (which will be passed when linking the static template) and then setting the button for the main template's deployment URL.

0 Votes 0 ·