Azure Analysis Service Role Creation using TMSL/XMLA

Andy 1 Reputation point
2023-07-25T16:37:18.93+00:00

Hi Everyone,

As per Microsoft site : https://learn.microsoft.com/en-us/analysis-services/tmsl/createorreplace-command-tmsl?view=asallproducts-allversions

createOrReplace for role creation is done only for one role , if we have multiple roles can someone share the script to add multiple roles in the single script

Thanks

Azure Analysis Services
Azure Analysis Services
An Azure service that provides an enterprise-grade analytics engine.
438 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. PRADEEPCHEEKATLA-MSFT 77,426 Reputation points Microsoft Employee
    2023-07-26T05:26:28.2766667+00:00

    @Andy - Thanks for the question and using MS Q&A platform.

    To create multiple roles using TMSL script, you can use the following sample script as a reference and modify it according to your requirements:

    {
      "createOrReplace": {
        "object": {
          "database": "SalesBI",
          "role": "Analyst"
        },
        "role": {
          "name": "Users",
          "description": "All allowed users to query the model",
          "modelPermission": "read",
          "members": [
            {
              "memberName": "user1@contoso.com",
              "identityProvider": "AzureAD"
            },
            {
              "memberName": "user2@contoso.com",
              "identityProvider": "AzureAD"
            }
          ]
        }
      }
    },
    {
      "createOrReplace": {
        "object": {
          "database": "SalesBI",
          "role": "Manager"
        },
        "role": {
          "name": "Managers",
          "description": "All allowed managers to query the model",
          "modelPermission": "read",
          "members": [
            {
              "memberName": "user3@contoso.com",
              "identityProvider": "AzureAD"
            },
            {
              "memberName": "user4@contoso.com",
              "identityProvider": "AzureAD"
            }
          ]
        }
      }
    }
    

    Note: In this sample script, two roles are created: Analyst and Manager. You can modify the script to add more roles as per your requirements.

    Hope this helps. Let me know if you have any further questions!

    0 comments No comments

  2. Andy 1 Reputation point
    2023-07-26T10:59:39.01+00:00

    @PRADEEPCHEEKATLA-MSFT

    I tried the way suggested by you but it failed and after doing more research on google I found this block to be added so that we can create multiple roles :

    {

    "sequence" : {

    "maxParallelism" : 3,

    "operations" :

    [

    {

    "createOrReplace": {

    "object": {

    "database": "dbtest1",

    "role": "roletest1"