Sunday, December 3, 2017

Deployment in AX 2012

Application Layer: A single layer of AX 2012 application that exists within a model store (NOTE: The elements in higher layers will override elements in lower layers)

Model Store: A collection of tables in the AX 2012 database that contains the application metadata. (NOTE: The model store can be compared to the AOD file share in AX 2009)

Metadata: Information about the properties or structure of data in the Application Object Tree (AOT) that is not part of the data values. (NOTE: Everything element that exists in the AOT is considered metadata)

Model store file (.axmodelstore): A complete model store that has been exported from the database. The file includes all metadata, compiled artifacts, CIL code, and security artifacts. The file is used for moving consistent metadata between environments with minimum downtime.

Model file (.axmodel): This is a model that has been exported from a model store. (NOTE: This file is the main vehicle of metadata deployment in AX 2012)

Moving right along , when deploying metadata between AX 2012 environments, we can do it using a number of different methods that range from importing/exporting XPO files to moving a whole model store file at once.

The following table shows a comparison between these methods (source:www.microsoft.com)


This might vary from project to project, but I believe that we should adopt a single and concise method that we can apply in our projects to quantify the results over a period of time, and to minimize downtime. 

In addition, I think that a crucial step to achieve a consistent deployment methodology is to understand that the environments we are moving data from/to need to have the same metadata structure. For example, in the last six months I have learned that if a customer already has a production AX 2012 instance running, the Test and Staging environments can and should be a replica of it to avoid conflicts on ID’s and model store metadata. 

We also need to ensure that any customizations we do, must first be applied to the source environment, then have them thoroughly tested, and then move them to the production environment via our preferable method. Otherwise, we open the door to inconsistency between environments. 


So, let’s take a look at how the deployment process should be (source:www.microsoft.com)



Microsoft has outlined a list of common mistakes that arise when importing a single model into a production environment.

1-We start with a customization that we want to move into the target environment.





2-Then we import the model that contains our customizations. Because this is a new object that does not exist in the target system (Stage/Production), AX might give the object an ID that is different from the ID in the source system.





3-Then, someone uses he system and adds transaction records that reference the AXID.





4-Let’s say that the next day we make another customization and want to deploy the entire model store for minimal downtime (which was a different approach from step 2). To do this, we export the entire model store, which includes the IDs.




As you can see, this inconsistency will create conflicts because the ID’s as the two instances have different ID's. 

Now, the idea is to choose one methodology and stick with it. However,Microsoft suggests importing the entire model store file from the beginning, so we don’t run into ID conflicts in future deployments. It is essential that the target database (especially in a production environment) is initialized from an exported source database and not individual model files.

The following sequence shows the correct way to move customizations between environments to avoid conflicts.

1-We start by creating a blank AX DB by using Setup. (This will contain the Foundation SYS model).





2-We initialize the model store by importing the model store file from the source to the target system.




3-When this happens, we can start adding data to the target system, and at the same time, customizations can be made to the source system.




4-Now, when we are ready to re-deploy new customizations, the entire model store is once again exported to minimize system downtime and to avoid ID’s conflicts. 


Thursday, November 16, 2017

Dynamics AX Date Calculator : How to get The difference between two date in ax 2012 in detail years months days


You often try to calculate the differences between two dates using the available functions in dynamics ax for dates. However, for example I have two dates such as start date = 07/07/2007 and end date = 01/11/2016 where date caculator would show difference like 9 Years 3 Months 25 Day. What if the same detail calculation I have to perform in X++. This post will save your time since we might sometimes require this code during ax programming.
 static void AXDateCaculator(Args _args)  
 {  
     int monthsDiff, daysDiff, yearsDiff;  
     date emergingDateMth, emergingDateYear;  
     str dateCalculated;  
     //Dates can be changed here  
     date startdate = mkDate(7, 7, 2007);  
     date endDate  = mkDate(1, 11, 2016);  
     ///  
     yearsDiff                  = intvNo(endDate,startDate,IntvScale::Year);       
     emergingDateYear              = DateMthFwd(startDate, yearsDiff*12);                          
     monthsDiff                 = intvNo(endDate,emergingDateYear,IntvScale::YearMonth);  
     if (monthsDiff < 0)  
     {    
       yearsDiff                = yearsDiff - 1;  
       emergingDateYear            = DateMthFwd(startDate, yearsDiff*12);                          
       monthsDiff               = intvNo(endDate,emergingDateYear,IntvScale::YearMonth);  
     }  
     emergingDateMth               = DateMthFwd(emergingDateYear, monthsDiff);  
     daysDiff                  = intvNo(endDate,emergingDateMth,IntvScale::MonthDay);  
     if (daysDiff < 0)  
     {  
       monthsDiff               = monthsDiff - 1;  
       emergingDateMth            = DateMthFwd(emergingDateYear, monthsDiff);  
       daysDiff                = intvNo(endDate,emergingDateMth,IntvScale::MonthDay);  
     }   
     if (yearsDiff)  
     {  
       dateCalculated             += strfmt(" Years: %1", yearsDiff);              
     }   
     if (monthsDiff)  
     {  
       dateCalculated             += strfmt(" Months: %1", monthsDiff);             
     }  
     if (daysDiff)  
     {  
      dateCalculated             += strfmt(" Days: %1", daysDiff);              
     }  
     info(dateCalculated);   
 }  
After you execute this code you will see this result:
Happy Daxing :)!

Wednesday, November 8, 2017

Microsoft Dynamics AX 2012 R3 on VMWare

We recently established our VMWare environment for AX but while putting all best hardware, we found sometime very slow performance. I reviewed all the practices offered by Microsoft even we are higher in specs but I believe this could not solve our problem. I also visited few clients who are using MS AX on Virtual environment and they all faced the same problem. I got a recommendation to move DB (SQL) server from VM to Physical. Will that resolve the issue. We have never gone beyond 75% where CPU or Memory but sometime even on 50% of CPU usage, windows gets hanged. I have installed RDS (Remote Desktop Server) and everyone logs in through RDWEB.
Can anyone who gone through this phase guide me to optimize my environment, We have 5 locations connected through MPLS and each MPLS connectivity is approx 2MB connection.
  • Transportation management
    Get global transportation planning and freight reconciliation.
  • Budget planning
    Create easy-to-use budget plan worksheet templates for Microsoft Excel.
  • Modern point of sale (POS)
    Engage with rich clienteling, real-time inventory lookup, and back-office capabilities.

For a complete list of functionality and more information, see the product sheet.

Microsoft Dynamics AX is a
client
and
server
system that contains
a
data
layer
,
business logic
layer
, and presentati
on
layer
.
Th
is document
describe
s
a
reference
architecture for
a fully
virtualized Microsoft
Dynamics AX
implementation
enabled by
EMC VNX
5400
.
.
NET Business
Connector
Internet Information Server
(
IIS
)
Microsoft SharePoint
WSS web
parts
Dynamics AX web
parts
Role Center
Sites
,
pages
Business Logic
Server Session Manager
SharePoint
Databases
Dynamics AX
databases
SQL Server
Application Object Server
(
AOS
)
Dynamics AX Enterprise Portal Server
Dynamics AX
Windows clients
Enterprise Portal web
clients
Developers
MorphX
Visual
Studio
.
NET Business
Connector
Dynamics AX Enterprise Framework
Figure 2.
Logical architecture of a Dynamics AX environment
Figure
2
s
hows the
major components in
a Dynamics AX environment
:
Dynamics AX Enterprise Portal
, which is built on top of SharePoint Server
and
provides a web
-
enabled
interface for end
-
users
Dyna
mics AX
Application Object Server (
AOS
)
, which
handles
business logic
SQL Server
provides data management
for Dynamics AX business models and
transactions

Friday, November 3, 2017

Models Projects and Packages in D365


Today we will highlight an important architectural change in Dynamics AX 365. In AX 2012, the only option we had was over-layering for any sort of customization/modification in the out of box functionality. We had models/projects as set of elements, as the part of a given layer. Each layer can have one or more models/projects. Models can be exported to files that have the .axmodel extension and projects can be exported to xpo file. In Ax 2012, models files and XPO's are used for deployment purpose. 

How do we customize or modify any element in DAX365?

In DAX365, we have same elements reside in Application Explorer and these elements are objects such as tables, forms and classes, menu items etc. Customization of any object is done once it is added into a project and a project is linked or associated with a model.

Model:

Unlike AX2012, In DAX365, creating a model is mandatory thing for any sort of customization. A particular model can contain multiple Visual Studio projects. Therefore you can say it is a collection of projects and a single project can have all or subset of elements from originating model. However, association of a project is only with a single model. It is basically a unit of development/customization. Metadata for models is stored locally on an XML file called a descriptor XML.

Package:

As it is already mentioned that previously in AX 2012, we used XPO's and model as deployment unit. However in DAX365, we have packages for deployment purpose. A package may contain one or more models. In addition to elements of the model, this also includes model metadata which is the description data that define the properties and behavior of the model.  Also a package can be exported to a file which can then be deployed into a staging or production environment. In other words, you can say package is an independent set of layers and models.  It's also a set of folders that consists of XML files representing the elements in the system. In this way, a package can be viewed as a mini model store. Physically package translates directly to unit of compilation which is an assembly or DLL file. Packages can reference other packages that is similar to how .NET assemblies can reference each other.

Packages References:

Referencing a packages is useful, when it is required to reuse a functionality that exists in to another package. In this way, one or more packages can be combined to create a deployable package. And lastly, XML files are stored in the model directory that sit inside the package directory.

Layers:

Layers are the traditional AX concept but in D365, there is a new process where we extend layers as shown below.


Also when you create your model, you specify which layer the model is going to live in. However the importance of layer is quite minimal for instance, you are not required to provide a key for your model to live in that layer. Previously layers were single stack of code that over-layered upon each other. This new process uses layers but they are located in independent stacks.

This was only an architectural overview of Dynamics AX 365, I would further elaborate how do we customize the elements with some examples.

Go through links for further explanation and understanding and share your feedback on the post in comments section.


Monday, September 25, 2017

vmware2

VMware's most notable products are its hypervisors. VMware became well known for its first type 2 hypervisor known as GSX. This product has since evolved into two hypervisor products lines: VMware's type 1 hypervisors running directly on hardware and their hosted type 2 hypervisors.
VMware software provides a completely virtualized set of hardware to the guest operating system.[75] VMware software virtualizes the hardware for a video adapter, a network adapter, and hard disk adapters. The host provides pass-through drivers for guest USB, serial, and parallel devices. In this way, VMware virtual machines become highly portable between computers, because every host looks nearly identical to the guest. In practice, a system administrator can pause operations on a virtual machine guest, move or copy that guest to another physical computer, and there resume execution exactly at the point of suspension. Alternatively, for enterprise servers, a feature called vMotion allows the migration of operational guest virtual machines between similar but separate hardware hosts sharing the same storage[76] (or, with vMotion Storage, separate storage can be used, too). Each of these transitions is completely transparent to any users on the virtual machine at the time it is being migrated.
VMware Workstation, Server, and ESX take a more optimized path to running target operating systems on the host than that of emulators (such as Bochs) which simulate the function of each CPU instruction on the target machine one-by-one, or that of dynamic recompilation which compiles blocks of machine-instructions the first time they execute, and then uses the translated code directly when the code runs subsequently (Microsoft Virtual PC for macOS takes this approach). VMware software does not emulate an instruction setfor different hardware not physically present. This significantly boosts performance, but can cause problems when moving virtual machine guests between hardware hosts using different instruction sets (such as found in 64-bit Intel and AMD CPUs), or between hardware hosts with a differing number of CPUs. Software that is CPU agnostic can usually survive such a transition, unless it is agnostic by forking at startup, in which case, the software or the guest OS must be stopped before moving it, then restarted after the move.
VMware's products predate the virtualization extensions to the x86 instruction set, and do not require virtualization-enabled processors. On newer processors, the hypervisor is now designed to take advantage of the extensions. However, unlike many other hypervisors, VMware still supports older processors. In such cases, it uses the CPU to run code directly whenever possible (as, for example, when running user-mode and virtual 8086 mode code on x86). When direct execution cannot operate, such as with kernel-level and real-modecode, VMware products use binary translation (BT) to re-write the code dynamically. The translated code gets stored in spare memory, typically at the end of the address space, which segmentation mechanisms can protect and make invisible. For these reasons, VMware operates dramatically faster than emulators, running at more than 80% of the speed that the virtual guest operating system would run directly on the same hardware. In one study VMware claims a slowdown over native ranging from 0–6 percent for the VMware ESX Server.[77]
VMware's approach avoids some of the difficulties of virtualization on x86-based platforms. Virtual machines may deal with offending instructions by replacing them, or by simply running kernel code in user mode. Replacing instructions runs the risk that the code may fail to find the expected content if it reads itself; one cannot protect code against reading while allowing normal execution, and replacing in place becomes complicated. Running the code unmodified in user mode will also fail, as most instructions which just read the machine state do not cause an exception and will betray the real state of the program, and certain instructions silently change behavior in user mode. One must always rewrite, performing a simulation of the current program counter in the original location when necessary and (notably) remapping hardware code breakpoints.
Although VMware virtual machines run in user mode, VMware Workstation itself requires the installation of various device drivers in the host operating system, notably to dynamically switch the Global Descriptor Table (GDT) and the Interrupt Descriptor Table (IDT).
The VMware product line can also run different operating systems on a dual-boot system simultaneously by booting one partition natively while using the other as a guest within VMware Workstation.

Desktop software[edit]

  • VMware Workstation, introduced in 1999, was the first product launched by VMware. This software suite allows users to run multiple instances of x86 or x86-64 -compatible operating systems on a single physical personal computer. Workstation Pro version 12 was released in 2016.[78]
  • VMware Fusion provides similar functionality for users of the Intel Mac platform, along with full compatibility with virtual machines created by other VMware products.
  • VMware Workstation Player is freeware for non-commercial use, without requiring a licence, and available for commercial use with permission. It is similar to VMware Workstation, with reduced functionality.

Server software[edit]

VMware ESXi[79], an enterprise software product, can deliver greater performance than the freeware VMware Server, due to lower system computational overhead. VMware ESXi, as a "bare-metal" product, runs directly on the server hardware, allowing virtual servers to also use hardware more or less directly. In addition, VMware ESXi integrates into VMware vCenter, which offers extra services

Cloud management software 

Application management 

The VMware Workspace Portal was a self-service app store for workspace management.[81]

Storage and availability 

VMware's storage and availability products are composed of two primary offerings:
  • VMware vSAN (previously called VMware Virtual SAN) is a software-defined storage solution that is embedded in VMware ESXi.[82][83] The vSphere and vSAN software runs on industry-standard x86 servers to form a hyper-converged infrastructure (or HCI) solution. You need to have servers from HCL (Hardware Compatibility List) to put one into production though. [84] The first release, version 5.5, was released in March 2014.[85][86] The 6th generation, version 6.6, was released in April 2017.[87][88] New features available in VMware vSAN 6.6 include native data at rest encryption, local protection for stretched clusters, analytics, and optimized solid-state drive performance.[89]
  • VMware Site Recovery Manager (SRM) is a disaster recovery solution that automates the failover and failback of virtual machines to and from a secondary site using policy-based management.[90][91]