web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SECURITYROLES table missing from SQL?

(0) ShareShare
ReportReport
Posted on by 170

Alright Dudes,

I'm just starting to put a query together within SQL and I don't seem to be able to find the SECURITYROLE table within the database. It certainly exists as I can query it directly from the AOT but when I use SQL Server Management Studio the same table doesn't show up.

It's entirely possible I'm doing (or not doing) something silly that I should already know about but for the life of me I can't figure out where I'm going wrong. Here are a couple of screenshots just to show you what I'm on about:

7510.AOT.jpg

7024.SQL.jpg

...and this is what I get when I try typing SECURITY into SQL:

34048.Capture.JPG

As always, any help greatly appreciated, you lot are brilliant.

Cheers

Dan

For is it not written, "we live and learn"?

*This post is locked for comments

I have the same question (0)
  • SpoonMan Profile Picture
    170 on at

    Oh yeah, just in case you're interested. This is what I have so far:

    Use MicrosoftDynamicsAX

    SELECT DISTINCT userinfo.NAME as "Full Name",

    sysuserinfo.EMAIL as "Email Address",

    userinfo.ID as "User ID",

    sysuserprofiles.PROFILEID as "User Profile ID",

    usergroupinfo.NAME as "User Group ID",

    userinfo.LANGUAGE as "Language",

    HELPLANGUAGE as "Alternate Help Language",

    sysuserinfo.DEFAULTCOUNTRYREGION as "Default Country/Region",

    userinfo.COMPANY as "Start Company Accounts"

    FROM USERINFO

    LEFT JOIN sysuserinfo

    ON userinfo.ID = sysuserinfo.ID LEFT JOIN sysuserprofiles

    ON sysuserprofiles.USERID = userinfo.ID LEFT JOIN usergrouplist

    ON usergrouplist.USERID = userinfo.ID LEFT JOIN usergroupinfo

    ON usergroupinfo.ID = usergrouplist.GROUPID

    WHERE userinfo.NAME != ''

    ORDER BY userinfo.NAME, usergroupinfo.NAME

    I can JOIN SECURITYUSERROLE easily enough but that's not a lot of good if I can't also use SECURITYUSER.

    This is how it looks in situ:

    7245.Capture.JPG

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hi Dan Ladle,

    Just check model store data base (it has name that usually is you AX data base name + "_model") .

    There you can find tables like ModelSecurityRole, ModelSecuritySubRole and so on.

  • SpoonMan Profile Picture
    170 on at

    I'm afraid that is completely different data to what I'm looking for. As you can see from my query, I'm trying to pull all the useful data about users into one simple table. The thing I want to add is the Security roles assigned to each user but the ModelSecurityRole table seems to consist of permissions in roles, rather than the titles of the roles themselves :-(

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    Ok, if you will look at views in model data base you will find securityrole, securityTask and all other table that you can see in system documentation node in AOT.

    However, they are based on ModelSecurity* tables under the hood.

  • Rati Sharabidze Profile Picture
    612 on at

    Hi Dan,

    Check this link.

    community.dynamics.com/.../208285

    Best regards

  • SpoonMan Profile Picture
    170 on at

    Sorry for doubting, you're absolutely correct (it's been a very long day) :-)

    This is the query as it currently looks (and definitely works).

    7673.Capture.JPG

  • Suggested answer
    Community Member Profile Picture
    on at

    select SecurityUserRole.user_ , userinfo.Name , securityRole.aotname

    from [MicrosoftDynamicsAX_model].[dbo].[SECURITYROLE] ,
    [MicrosoftDynamicsAX].[dbo].[SECURITYUSERROLE] ,
    [MicrosoftDynamicsAX].[dbo].[userinfo]

    where securityRole.RecId = SecurityUserRole.SecurityRole and
    userinfo.id = SecurityUserRole.user_ and

    userinfo.enable = 1 
    order by SecurityUserRole.user_ , securityRole.aotname

    ;

  • Community Member Profile Picture
    on at

    I Cannot find table "securityrole" but can find other tables like SecurityUserRole, UserInfo  etc ? what could be the reason

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans