Security in Microsoft Dynamics 365 for Operations

By - May 18, 2017

Introduction

Security in Microsoft Dynamics365 for Operations is essential now.  Securing the objects that you have created is a requirement of new development within Microsoft Dynamics 365 for Operations (MsDyn365). This article explores the security operations of roles, duties, and privileges. In this case, we will try possibilities using a familiar tool, the Magic 8 Ball®. The Magic 8 Ball (made by Mattel®) is a mysterious device that provides solutions to all of life’s questions with a simple shake of the ball. Beneath the murky blue netherworld, there are many more choices than expected. Our example builds upon previous articles were we covered database manipulation, X++ control statements, and the user interface. This expands upon those ideas and finishes them up with a security design that allows specific access to the Magic 8 Ball.

Setup

For our process we will need a couple of different privileges for Magic 8 Ball. It is key to privilege development to create a “view” for view-only processes and a “maintain” view for maintenance of the data.  This project will also have a new model dependency in order to incorporate the extension of the Fleet Management menu in the demonstration image, if it is not already enabled.

Privilege Creation

  1. Open Visual Studio as an Administrator and open the
  2. Right-click the project, and select Add > New Item.
  3. Select Security > Security Privilege.
  4. Enter CrazyLuckyResultsView for the name and click Add.
  5. Right-click the project, and select Add > New Item.
  6. Select Security > Security Privilege.
  7. Enter CrazyLuckyResultsMaintain for the name and click Add.
  8. Save all and click Build.
  9. Ensure that there are no errors. If you have an error resolve and rebuild.

security_01_setupprivileges

Update Model Dependency

  1. Click the Dynamics 365 menu and select Model Management > Update model parameters.
  2. Select CrazyLucky and click Next.
  3. Select FleetManagement.
  4. Click Next.
  5. Click Finish.

The Configuration

We will need to attach the menu items to the new privileges, extend the roles, and add the privileges to the roles.

Attach Menu Items

  1. In the Solution explorer, expand the Display Menu items if they are not already visible.
  2. Drag the CrazyLuckyResults menu item from Display menu items to the entry points for CrazyLuckyResultsMaintain.
  3. Select the new created CrazyLuckyResults Entry point  security_02_configureprivileges
  4. Configure by setting the access level to Deletesecurity_03_configureprivileges
  5. Select the CrazyLuckResultsView privilege and click Open. (If it is already open in middle pane, select it.)
  6. Drag the CrazyLuckyResults menu item from Display menu items to the entry points for CrazyLuckyResultsView.
  7. Configure by setting the access level to Read.  security_04_configureprivileges
  8. Save all and click Build.
  9. Ensure that there are no errors. If you have an error, resolve and rebuild.

Extend Roles

  1. In the AOT, expand Security > Security Roles.
  2. Right-click FMClerk and select Create extension.
  3. Right-click FMManager, and select Create extension.
  4. In the Solution Explorer, right-click the new Extension and select Open.
  5. Drag the CrazyLuckResultsView privilege to the privileges of FMExtension in the middle pane.                                                                             security_05_extensionroles
  6. In the Solution Explorer, right-click the new Extension and select Open.
  7. Drag the CrazyLuckResultsView privilege to the privileges of Extension in the middle pane.
  8. Save all and click Build.
  9. Ensure that there are no errors. If you have an error, resolve and rebuild.

 

Review the Results

Now the real fun begins: you can now test your security with your Magic 8 Ball in the user interface.  If you are unfamiliar with the process, follow the steps below.

Assigning the Role

  1. Open Dynamics 365 for Operations as an Administrator.
  2. Click Show navigation pane.
  3. Open System Administrator > Users > Users.
  4. Select the user for testing. Note: This must be an AAD user from your domain that you know the password for.
  5. Once in the user, unassign all roles except Employee and System User.
  6. In the Action Pane strip, click Assign Roles > Select Fleet management clerk.    security_06_assignroles
  7. Click OK.
  8. Log out of Dynamics 365.

Testing the Interface

  1. Open Dynamics 365 for Operations as the assigned user.
  2. Open the Fleet Management module.
  3. Click Crazy Lucky Result Decision Maker under Rentals.
  4. The following are the results for the FMClerk. Notice the grayed out section for Edit and Delete.                                                                                                                                                         security_07_fmclerk

 

 

Now you can return to the Assign Roles step as Administrator and use the Fleet management branch manager.

  1. Open Dynamics 365 for Operations as the assigned user.
  2. Open the Fleet management
  3. Click Crazy Lucky Result Decision Maker under Rentals.
  4. The following are the results for the FMManager. Notice the ability for edit and delete.

security_08_fmmanager

Conclusion

This article explored the key aspects of the basic security design in MsDyn365 for the Magic 8 Ball. First, we set up the privileges needed for the view and maintain of the CrazyLuckyResults List Page. Second, we configured the two privileges after adding the menu items. Next, we added the new privileges to role extensions for use. Then we tested the model by assigning the new role extension to a user.

 

Additional development beyond this point would include the user interface for the CrazyLuckyTable were the user can change the comments. With that expansion, there would be a duty or privilege that can be created that would be called Enable allow for the setup of the table.

 

A challenge for you to do right now is to ensure the Action Menu Item Eight Ball is properly configured so that you can run the application. Enjoy the Magic 8 Ball, but keep in mind that it is not recommended for production or for those 100+ years and older!

 

For more information, I would recommend that you attend our Dynamics AX or Dynamics 365 training in person or on-demand online to learn more.

Plus keep an eye out for more articles that dive in to the technical aspects of using X++ code.  Visit academy.rsmus.com for more information and training materials that will cover this and hundreds of other topics for AX2012 and MsDyn365

Configure by setting the access level to Delete.

Receive Posts by Email

Subscribe and receive notifications of new posts by email.