Error message explained: The ‘Role’ with ‘ID’ = ‘Role 1’ doesn’t exist in the collection.

Error message explained: The ‘Role’ with ‘ID’ = ‘Role 1’ doesn’t exist in the collection.

It could happen that you move around your cube files and with the deployment, you run into some errors. A common error that I’ve encountered again is the following.

The ‘Role’ with ‘ID’ = ‘Role 1’ doesn’t exist in the collection.
This happens mostly when you have copied a .cube and .partitions file to another project and added this to the new SSAS project/solution.
The underlying meaning of this error is that in your cube file, you have a role defined in your old project that has set specific permissions on this cube. When this role does not exist under the same name and the same permissions set in the new project, your deployment will fail with the above error.
I’ve always deleted the permissions on the cube and re-created them again with the roles that I’ve used in the new project. You can do this by opening up the cube file in Notepad or another text editor, and look for the text CubePermissions. Everything starting at this term (including the tag of CubePermissions as well), remove that node from the file.
Apart from possible other errors that you might stumble upon, your copied cube should now be able to be deployed.

6 thoughts on “Error message explained: The ‘Role’ with ‘ID’ = ‘Role 1’ doesn’t exist in the collection.

  1. Hi Eric,

    I deleted and recreated my roles and now I am getting the error “The ‘MySSAS’ database was not found on the ” server”. I just deploued my dev project to production and then I am doing rollback. I deleted database and deploying Prod SSAS solution

  2. Hi Oleg, sorry for my late reply. I’ve seen the message before but I think I received this in a different context than you do. From what I can remember to solve this was to unprocess my cubes and dimensions and reprocess them.
    Cheers, Erik

  3. I would like to post the solution I found to this, as it was a bit more elegant, and I didn’t have to blow away anything significant. SSAS creates Roles inside the CubePermissions tag of the xml for the Cube, which you can see by righ-clicking the cube and clicking View Code. The first role gets a nested tag of Role, the second role ceated gets a tag of Role 1. When you delete a role from the solution, you need to go back and physically delete the .role file created. Visual Studio will start creating Role, Role 1, etc. again. After you have created a role, you can rename them to anything you want, and modify security as appropriate. However, the cube .xml still refers to the Role, Role 1. It would be nice if the cube .xml got updated with the newly updated Name to keep things consistent.

  4. You can get this error also if you have DimensionPermissions tag in the .dim files. I solved mine by deleting the entire tag from all the .dim files I had in my project.

  5. I know this is an old post! But today I had to change the Database ID on my SSAS project. After doing that (Show all file, right click on MyProject.database and say View Code” where I change the ID (and name) of the database) I got the problem.

    In my Roles folder I had three roles. By Selecting them one by one and pressing F7 (or View Code) I got the ID of the individual Role. My error message specified that it was “Role” which was not found. So I found the role where the ID was Role and renamed the Role to Role.role. Then it all worked worked like a charm.

    And after the first successful deployment, I would rename the role back to its original name again.

Leave a Reply

Your email address will not be published. Required fields are marked *