Monday, September 9, 2013

Workflow threw an exception for the following reason: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.



It looks like the AOS configuration settings generates the error, “The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.”  There has been some confusion on the AOS Server, this should be the actual server name not the AOS instance name.  Can you please verify the same?

I would also like you to verify the AOS services port.  To find the AOS services port, review the AX32Serv.exe.config file on the AOS server. By default, this file is located at (:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\AX32Serve.exe.config)

The default port number is 8201.

Sharepoint 2013 server installation issue App Fabric

Resolution
Solution 1
=======

Append the following path to PSModulePath entry in the environment variables - %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

•Go to 'My Computer', right-click 'Properties'
•On the 'System' page, click 'Advanced System Setings' on the left-side pane.
•If you receive n UAC prompt, click on Yes to launch the 'System Properties' dialog box
•From the 'Advanced' tab, click 'Environment Variables'
•Within the 'System Variables' section on the lower half, select 'PSModulePath' and click on Edit (you can also double-click 'PSModulePath')
•Append the following path to PSModulePath entry in the environment variables
         %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

•Ensure that the 'PSModulePath' entry looks like this:

C:\Windows\system32\WindowsPowerShell\v1.0\Modules\; C:\Program Files\AppFabric 1.1 for Windows Server\PowershellModules
Solution 2
=======

There are chances that other applications might be referencing the same variable and may fail if it is deleted. This is what we can do if solution 1 does not help. Remove the PSModulePath entry from the 'Environment Variables' and re-run the installer. Once it completes successfully, ensure that the 'PSModulePath' entry looks the same as mentioned in solution 1.

Solution 3
=======

You can download the list of prerequisites from Links to applicable software http://technet.microsoft.com/en-us/library/cc262485.aspx#section5

Follow these steps for installing AppFabric for Windows Server correctly

1.Uninstall the Appfabric for Windows Server from Control Panel -> Programs and Features page
2.Download the individual requirements to a network location or a local folder
3.Install prerequisites for SharePoint 2013 manually

- From the Start menu, open the Command Prompt window using the Run as administrator option.
- Navigate to the root of the SharePoint 2013 installation media or folder location
- Type the prerequisite program switch and corresponding argument for the program that you want to install, and then press ENTER. For example:


if we have to install AppFabric for Windows Server from a local source, we can run the following command:

PrerequisiteInstaller.exe /AppFabric:

This will kick off the prerequisite installer wizard which will then use the installation file stored locally on the machine as specified in the command-line to install Windows Server AppFabric. We can also install more than one prerequisite by using different switches with the PrerequisiteInstaller.exe command to install multiple components and specifying the installation path in the command line window. For example:

PrerequisiteInstaller.exe /AppFabric:  /IDFX11:

This command will install Appfabric and Windows Identity Foundation

4.Run the following command:

PrerequisiteInstaller.exe /AppFabric: /IDFX11:"\Microsoft Identity Extensions.msi" /MSIPCClient:"\msipc.msi"  /WCFDataServices:"\WcfDataServices.exe" /KB2671763:"\AppFabric1.1-RTM-KB2671763-x64-ENU.exe

where "" signifies the file location from where you want to install. If you do not specify the option, the installer downloads the file from the Internet and installs it.

Monday, August 5, 2013

Claims-Based Flexible Authentication in Dynamics AX 2012

Dynamics AX 2012 provides a new way to authenticate users in AX, called claims-based / flexible authentication. In this approach, you don't have to create users in Active Directory first to give them access to use AX Enterprise Portal / AIF. And this is really a very nice and a way to go approach for giving AX access to external users who are not part of the organization's Active Directory structure. For example; now you are no longer required to create vendors and customers in Active Directory to have them access vendor self-service portal or customer self-service portal respectively.

AX achieves this by using the concept of trusted intermediary. This trusted intermediary can be anything (a website, service, or mobile app etc) that runs under the identity of a authenticated AX user account. This means that AX trusts the intermediary users or user groups and allows them to impersonate another user. In other words, the user authentication is done by trusted intermediary instead of AX. This also means that authenticated users, call into AX as trusted intermediary user and execute AX code / functionality as that authenticated user.

On Enterprise Portal, we implement this by creating a Trusted Identity Provider on SharePoint 2010 that will authenticate users on behalf of AX.

Dynamics AX 2012 introduces two new kind of user types other then Active Directory user, called Active Directory group and Claims user. For this post, we are dealing with Claims users only. 

In this post, we will create a claims aware Enterprise Portal site to authenticate users by using a forms-based authentication provider site. On forms-based site, users will be able to enter their credentials in a logon form. By default, Dynamics AX 2012 supports the forms-based authentication providers in ASP.NET.

Ok, enough talking.... it's time to get hands dirty.

Before getting started we need to make sure that following components are already installed.
  • .Net Business Connector
  • Management utilities 
  • Enterprise Portal: If you have it installed then nothing needs to be done here, else, while installing make sure that you don't configure SharePoint and create website at this point, we will do it later in this post.
SSL certificate:
We need to register a Secure Sockets Layer (SSL) certificate on the Enterprise Portal Server. For now, we can create a self-signed server certificate in IIS 7.0 but for production server, you must register an SSL certificate from a certificate authority on the Enterprise Portal Server.This certificate helps to make sure that user's claim was not changed in transit.

Create a Self-Signed Server Certificate in IIS 7.0:
  1. Open IIS Manager (command line: inetmgr) and select server or the level you want to manage.
  2. In Features view, double-click "Server Certificates".

  3. In the Actions pane, click "Create Self-Signed Certificate".
  4. On the "Create Self-Signed Certificate" page, type a friendly name for the certificate in the "Specify a friendly name for the certificate" box, and then click OK.
    I created mine with the name "Rah-SelfSignedCert".
  5. Export it with password and save it on a file location. We will need it while registering it.

Register SSL certificate on the Enterprise Portal server:
  1. On the Windows server that will host the claims-aware Enterprise Portal site, click Start > Run, type mmc, and then click OK.
  2. Click File > Add/remove snap-in.
  3. Click Certificates, and then click Add.
  4. When the system prompts you to specify which type of account to manage certificates for, click Computer Account, and then click Next.
  5. Click Local computer, and then click Finish.
  6. In the Add or Remove Snap-ins dialog box, click OK.
  7. In the MMC snap-in, click the Certificates (Local Computer) node.
  8. Right-click Personal, and then click All tasks > Import. The Certificate Import Wizard opens.
  9. Click Next.
  10. Browse to the SSL certificate  "Rah-SelfSignedCert.pfx"  for the Enterprise Portal site, and then click Next.
  11. Enter the password for the certificate, and then click Next.
  12. Select the Mark this key as exportable option, and then click Next. The Certificate Store dialog box appears.
  13. Click Next.
  14. Click Finish.

Create claims-aware Enterprise Portal site:
In this section, we will use Microsoft Dynamics AX 2012 Management Shell (Microsoft Windows PowerShell) cmdlet. This cmdlet will first creates a claims-aware web application in SharePoint and then deploys an Enterprise Portal site on that web application.


  1. Click Microsoft Dynamics Ax 2012 Management Shell.
  2. Execute following command.
    $Cred = Get-Credential
  3. When prompted, enter the credentials of the user that you want to set up as the site administrator of the Enterprise Portal site that will be created.
  4. Execute following command, replacing “PathToSSLCertificate” with the path of the SSL certificate that you imported earlier in this post.
    $SSLCert = Get-PfxCertificate "PathToSSLCertificate"
  5. On the Enterprise Portal server, execute the New-AXClaimsAwareEnterprisePortalServer cmdlet. new-AXClaimsAwareEnterprisePortalServer -Credential $Cred -Port 90 -SSLCertificate $SSLCert
In the above example, 90 is a port number we are using to create Enterprise Portal site though you can use any free port number. Once this command is done, you can browse the new instance of Enterprise Portal at:
https://ServerName:PortNumber/sites/DynamicsAx

Forms-based authentication:
In this section, we will setup and create a custom authentication mechanism to authenticate external users. Forms authentication enables you to authenticate the user name and password of your users using a login form that you create. So for this, we will be creating a forms-based website and a database to hold external user credentials.

External user credential database:
For this post, we will use ASP.NET database to store external user credentials. This database works with standard ASP.NET forms-based authentication provider. Use following command to create ASP.NET database:
  • Open a Command Prompt window by using an administrator account on the server. Execute the following command.
    %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regsql.exe
  • The ASP.NET SQL Server Setup Wizard opens.

  • Complete the wizard. The wizard creates a new database in Microsoft SQL Server called aspnetdb if you choose in database name or whatever name you give.
NOTE: If you change the default name of the database then don't forget to change it in the web.config of forms-based provider's website as well.

Create a self-signed certificate:

A self-signed certificate is used to establish trust between the claims-aware Enterprise Portal site and the forms-based site. The command in the following procedure creates a self-signed certificate and registers that certificate with the local computer.
  1. On the Enterprise Portal server, click Start > All Programs.
  2. Click Microsoft Visual Studio 2010. If Visual Studio is not installed on the local server, execute the command on a server where Microsoft Visual Studio 2010 is installed, and then copy the certificate to the Enterprise Portal server.
  3. Click Visual Studio Tools > Visual Studio Command Prompt.
  4. Let's name this certificate as "Rah-Forms-Cert". 
makecert.exe -r -pe -a sha1 -n "CN=Rah-Forms-Cert" -ss My -sr LocalMachine -sky exchange -len 2048 -sp "Microsoft Enhanced RSA and AES Cryptographic Provider" -sy 24 c:\certs\Rah-Forms-Cert.cer 

Create forms-based provider and register it as a claims provider in SharePoint for Enterprise Portal:
  1. Click Microsoft Dynamics Ax 2012 Management Shell.
  2. Execute following command.
    $Cred = Get-Credential
  3. When prompted, enter the credentials of the user that you want to set up as the site administrator of the forms-based STS site that will be created.
  4. Execute following command, replacing “PathToSSLCertificate” with the path of the SSL certificate that you imported earlier in this post.
    $SSLCert = Get-PfxCertificate "PathToSSLCertificate"
  5. Execute the following command.
    $SigningCert = Get-PfxCertificate c:\certs\Rah-Forms-Cert.cer
  6. On the Enterprise Portal server, execute the Add-AXSharepointClaimsAuthenticationProvider cmdlet.
Add-AXSharepointClaimsAuthenticationProvider -Type Forms -Name FormsAuth -SigningCertificate $SigningCert -Credential $Cred -Port 91 -SSLCertificate $SSLCert

In the above example; our Trusted Identity Provider's name is FormsAuth and the forms-based security token service (STS) website is deployed on port 91. You can choose any name and free port.

To make sure that we have registered the provider on our Enterprise Portal site, do following:
Go to SharePoint Central Administrator site >> Security >>  Manage trust, and make sure that you have FormsAuth there.





Also, go to SharePoint Central Administrator site >> Security >> Specify authentication provider, and make sure that you have Claims Based Authentication provider registered with proper settings.



The main thing is to see if it has Trusted Identity Provider set to FormsAuth.


NOTE: One last thing to check if you have a custom name for your ASP.NET database then you need to change the  database name in the connection string of provider's web.config as well.



Create claims users:
Now as we have our Enterprise Portal site and forms-based site created and ready to test, it's time to create few user for testing. We need to create users first in forms-based credentials database for authentication and then in AX for giving them access to different AX modules.

We can create our users by using New-AXUser cmdlet of the AX Management Shell. This cmdlet will create users in both the databases. For example; below command will create a user with the name of rahul, account type Claims user, AXUserIdrahul, domain name will be the name of the claims provider we created above that is FormsAuth and finally the password.

New-AXUser -AccountType ClaimsUser -AXUserId rahul -UserName rahul -UserDomain FormsAuth -CreateInProvider -ClearTextPassword "manager@1"

NOTE: You can change password policy in the provider's web.config file.

By default New-AXUser cmdlet adds the new user in System user role. You can assign required roles in AX if needed.

You also need to define the relationship of this user to a AX person in system, like vendor / customer.


This relationship will allow user rahul to logon in to the vendor portal for vendor "Contoso Asia" as contact "Biran Groth". You can assign more then one person or vendor or customer to a single user and on Enterprise Portal you can change the role accordingly.

Grant permission to all forms-based authenticated users:
This can be achieved in any of the following ways:
  • Browse to SharePoint Administrator site
  • Go to your Enterprise Portal web application
  • Open User Policy and add Read only access for all authenticated FormsAuth users.
Another way to grant permission is:
  • Browse to the SharePoint Server 2010 Enterprise Portal site that you created and log on using the administrator account.
  • On the Site Actions menu click Site Settings.
  • In the Users and Permissions section, click Site Permissions.
  • Click Site Name Visitors group, where Site Name is the name of the site.
  • Click New, and then click Add Users.
  • In the Grant Permissions window, click the browse icon.
  • In the Select People and Groups window, click All Users, and then click All Users (FormsAuth) in the right pane.
  • Click Add.
  • Click OK.
  • Verify that All Users (FormsAuth) is now part of the visitor’s group. You should now be able to log on to the SharePoint Server 2010 site with FormsAuth user’s credentials.
Test functionality:
Now if you go to the Dynamics AX Enterprise Portal URL (https://ServerName:PortNumber/sites/DynamicsAx), the Sign In page will prompt you to select a logon option in a drop-down list. In our setup URL will be, https://ServerName:90/sites/DynamicsAx


If you select FormsAuth, you will be redirected to the forms-based authentication logon site.


After sign in, depending on the roles of that user in AX, you will be redirected to the Enterprise Portal. In our case, user only has vendor portal roles assigned for one vendor. If user has more than one relationship defined then he can navigate from one role to another on Enterprise Portal itself.



Note: There can be instances where instead of having Vendor credential database, organization can decide to go with having a separate Active Directory for vendors. For this, same concept can be used where you will setup Active Directory Federation Services instead of Forms-based authentication.

That's it for today. Next time we will see how to use this concept with AIF where you can access AIF service using claims user

Tuesday, July 2, 2013

Users in AX 2012

Question: How many type of users are in Dynamics AX 2012 and what are their duties?
Answer: There are four types of user in AX 2012
1.     Enterprise
2.     Functional
3.     Task
4.     Self Server
Enterprise User:
·         Unrestrictive access to setup, administer all parameters and functional processes across the enterprise. Key Roles whose work impacts multiple users’ activities or tasks such as budgeting, forecasting, planning or scheduling

·         Manage complete cross organizational activities and business including: Legal, Financial, Payroll, Compensation & Benefits and IT

·         Setting up and Defining Organizations, Business Unit, departments, divisions, Positions, and employee Jobs

·         Access to all Manufacturing Roles and functions excluding Shop Floor Control and Quality Management

·         Managing cross organizational processes

·         Approving professional user processes

Functional Users: 
·         Manage a set of activities in the process to create, fabricate, sell, deliver, or support the product or the service sold by their company.

·         Manage a shop floor within a production or manufacturing cycle.

·         Manage a set of projects and related services incl. the management of relevant resources.

·         Manage HR cycles: Recruitment, Trainings, and On/Off boarding of employees.

·         Manage budget transfers and requests pertaining to his / her operational department, division, or unit.

·         Create applicants / employee master data records; create a job or a position requisition within the organization.

·         Raise invoices pertaining to their clients.

·         Approve Vendor invoices or voucher for rendered services.

·         Create and Manage master data records pertaining to their Customers, Vendors, as well as their product inventory or catalog.

·         Approver of Self Serve or Task Users.

Functional Users do not and cannot perform (these are completed by Enterprise Users):

·         ERP system setup, Data base setup or reports customizations.

·         Functions related to setting up (System Configuration) projects, productions, services or financial parameters (Product, Inventory, projects, production, route, service grouping, etc.)

·         financial Transactions related to Employee Payroll, Customer and vendor settlements, payments, credits, checks, cash dispenses, all Accounting functions & activities
·         transaction spanning cross Business Units or Legal entities processes: Budgeting and Resourcing

Task User:
Users access the system to:
·         Enter billable time (Project Activities, Production card, etc.)
·         Billable expenses (project and other types)
·         Performance management and goal setting, annual reviews, etc.

Self Serve User:

·         Employee Self Serve Discrete Scenarios (Payroll Clock In/Out, Expense Report, Personal Data, Time & Attendance, Personal Service Requisitions

Dynamics AX technical consultant interview questions

1.      How can we create primary key for a table?

2.      what precautions you need for overriding fetch() method for a report?

3.      Difference between OCC (Optimistic concurrency control) and PCC (Pessimistic concurrency control)?

4.      How many types of MAP there in Dynamics AX?

5.      What is cache lookup what is it used for?

6.      Difference between table and views?

7.      why we use dialog? and how to accomplished it?

8.      what are the different type of index?

9.      Difference b/w cascade + restricted and restricted delete actions?

10.  In which case delete_from and delete() have same result?
Delete() will delete one record at a time.

Delete_from can delete multiple records at a time.


11.  Explain sales/purchase order processes in AX.

12.  Can you just tell the table properties that you can remember

13.  Different types of relation? Explain it detail?

14.  Explain Queries? What’s it used for?

15.  Explain different types of reports?
There are two types of reports in AX

16.  Differentiate auto design spec & Generated design? Which one is a preferable choice and why ? 



17.  What are all the add- on tools you used in Dynamics AX (It’s an indirect question for AIF)



19.  What is the default index for a table?

       Default Index in Table

20.  Did you work with EP (Enterprise Portal & Workflow) how you can implement this features into your projects ?
       EP in AX 2012

21.  Can you just point out some best practice you used when u develop a project? 


22.  Did you worked with base modules? 



Question: What is the default index for a table ?

Microsoft Dynamics AX requires a unique index on each table. If there are no indexes on a table or all the indexes are disabled, a system index is automatically created. The system index is created on the RecId and DataAreaId fields if the DataAreaId field exists. Otherwise, the system index is created on the RecId field. You can see system indexes in the database, but they aren't visible in the AOT. 

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...