Friday, December 23, 2022

Lock resources in Azure

As an administrator, we can lock an Azure subscription, resource group, or resource to protect them from accidental user deletions and modifications. The lock overrides any user permissions.

You can set locks that prevent either deletions or modifications. 

These locks are of 2 types 

1. Delete

2. Read-only

Delete means authorized users can read and modify a resource, but they can't delete it.

ReadOnly means authorized users can read a resource, but they can't delete or update it. Applying this lock is similar to restricting all authorized users to the permissions that the Reader role provides

When you apply a lock at a parent scope, all resources within that scope inherit the same lock. Even resources you add later inherit the same parent lock. The most restrictive lock in the inheritance takes precedence.

Tuesday, December 20, 2022

Common XSLT syntax

Declaring a variable

<xsl:variable name="CanonicalHeader" select="/n0:CanonicalPurchaseOrderAck/Header"/>

Fetching the value in XSL tag

<xsl:value-of select="$CanonicalHeader/PurchaseOrderNumber"/>

If condition in XSL

<xsl:value-of select="$CanonicalHeader/Addresses/Name[EntityIdentifierCode1 = 'ST']/IdentificationCode"/>


<xsl:value-of   select="/ns0:X12_00401_210/ns0:LXLoop1/ns0:L5[L502='FUEL SURCHARGE']/../ns0:L1/L104/text() div 100"/>

If - Else (Example 1)


<xsl:when test="$CanonicalHeader/Addresses/Name[EntityIdentifierCode1 = 'ST']/IdentificationCode != ''">

<xsl:value-of select="$CanonicalHeader/Addresses/Name[EntityIdentifierCode1 = 'ST']/IdentificationCode"/>




Missing EntityIdentifierCode1 ST




If - Else (Example 2)


<xsl:when test="$CanonicalHeader/Dates[DateTimeQualifier = '004']/Date != ''">

<xsl:value-of select="$CanonicalHeader/Dates[DateTimeQualifier = '004']/Date"/>




Missing DateTimeQualifier 004




Taking 1st/2nd from n tags

<xsl:variable name="FromAddressCity" select="/ns0:X12_00401_210/ns0:LXLoop1/ns0:N1Loop3/ns0:N4_3/N401"/>

<xsl:value-of   select="$FromAddressCity[1]"/>

Current time


<xsl:value-of   select="current-dateTime()"/>


For each loop


<xsl:for-each select="./ns0:X12_00401_210/ns0:LXLoop1/ns0:L5">



<xsl:value-of select="../ns0:L5/L502"/>



<xsl:value-of select="../ns0:L5/L502"/>



<xsl:value-of select="../ns0:L1/L104 div 100"/>





Copy and paste the below code into notepad++ for better visualization.


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="3.0"   



<xsl:variable name='Valuee' select="/ns0:X12_00401_110/ns0:B3/B302"/>

<xsl:template match="/">




<xsl:value-of select="/ns0:X12_00401_110/ns0:B3/B302"/>



<xsl:value-of select="'U100004'"/>



<xsl:value-of select="/ns0:X12_00401_110/ns0:B3/B312"/>



<xsl:value-of select="/ns0:X12_00401_110/ns0:B3/B307 div 100"/>



<xsl:value-of select="/ns0:X12_00401_110/ns0:B3/B312"/>




<xsl:value-of select="/ns0:X12_00401_110/ns0:B3/B302"/>



<xsl:value-of select="'U100004'"/>



<xsl:value-of select="/ns0:X12_00401_110/ns0:B3/B312"/>



<xsl:value-of select="/ns0:X12_00401_110/ns0:B3/B312"/>



<xsl:value-of select="/ns0:X12_00401_110/ns0:B3A/B3A02"/>



<xsl:value-of select="/ns0:X12_00401_110/ns0:B3/B307 div 100"/>



 <xsl:value-of select="/ns0:X12_00401_110/ns0:LXLoop1/ns0:N1Loop2/ns0:N9_2[N901 = 'AW']/N902/text()"/>  



<xsl:value-of select="/ns0:X12_00401_110/ns0:LXLoop1/ns0:N1Loop2/ns0:N9_2[N901='IT']/N902/text()"/>



<xsl:value-of select="/ns0:X12_00401_110/ns0:N1Loop1/ns0:N9[N901='14']/N902/text()"/>



  <xsl:when test="contains(./X12_00401_110/ns0:N9/N902,'SALE') or contains(./X12_00401_110/ns0:N9/N902,'Sale')">

  <xsl:variable name='ValueUSO' select="substring(./X12_00401_110/ns0:N9/N902,8,3)"/> <!--set value-->


    <xsl:when test="($ValueUSO='USO')">

       <xsl:variable name='ValueUSO2' select="substring(./X12_00401_110/ns0:N9/N902,12,8)"/> <!--set value-->

       <xsl:variable name='CustRef' select="concat('USO-',$ValueUSO2)" />


        <xsl:value-of select="$CustRef"/>





         <xsl:when test="contains(./X12_00401_110/ns0:N9/N902,'USR') or contains(./X12_00401_110/ns0:N9/N902,'Usr')">

         <xsl:variable name='CustRef' select="substring(./X12_00401_110/ns0:N9/N902,8,100)" />


          <xsl:value-of select="$CustRef"/>










<xsl:for-each select="./ns0:X12_00401_110/ns0:LXLoop1/ns0:L5Loop1/ns0:L1Loop1">



<xsl:value-of select="../../../ns0:B3/B302"/>



<xsl:value-of select="'U100004'"/>



<xsl:value-of select="../../../ns0:B3/B312"/>



<xsl:value-of select="../../../ns0:B3/B312"/>



<xsl:value-of select="ns0:L1/L104 div 100"/>



<xsl:value-of select="ns0:L1/L108"/>









Saturday, December 10, 2022

Shortcut keys for visual studio and windows to boost your productivity


Visual Studio:

Solution explorer > Ctrl + Alt + L

Team Explorer > Ctrl + \, Ctrl + M

Application Explorer > Ctrl + E, Ctrl + E

Properties > Alt + Enter

Open notifications > Window + N

Build > Ctrl + Shift + B


Switch between windows > Alt + Tab || Alt + Shift + Tab

Switch between desktops > Ctrl + Window + Left arrow || Ctrl + Window + Right arrow

Create new desktop > Ctrl + Window + D

Lock windows > Window + L

Re-open closed browser window > Ctrl + Shift + Tab

Find > Ctrl + F

Bookmark a page in chrome > Ctrl + D

Rename a file > F2

Launch file explorer > Windows + E

Switch tabs > Ctrl + Tab

Snipping tool screenshot > Window + Shift + S

Friday, December 9, 2022

After restore the DB from UAT or Prod to Dev Environment to Copy the admin user from Dev backup to new restored DB


DECLARE @NetworkAlias NVARCHAR(255)

–Get the SID, NetworkAlias from the original database
@SID = [SID],
@NetworkAlias = NetworkAlias
FROM [AxDB_Orig].[dbo].[UserInfo]
WHERE Id = ‘Admin’

–Restore the SID, NetworkAlias to the restored database
UPDATE [AxDB].[dbo].[UserInfo] SET
[SID] = @SID,
NetworkAlias = @NetworkAlias
WHERE Id = ‘Admin’

Create a custom web service in D365FO Integration (Data Sending) Outbound

Share the data of a table using soap services

In our case let's create a table DAP_Worker with the fields Name, Phone, Address

Now create a class "GITSWorkerList"


class GITSWorkerList


    Name    Name;

    Name    Phone;

    Name    Address;


    public Name Name(Name _Name = Name)


        Name = _Name;

        return Name;


    public Name Phone(Name _Phone = Phone)


        Phone = _Phone;

        return Phone;


    public Name Address(Name _Address = Address)


        Address = _Address;

        return Address;



Now create a service class "GITSWorkerService"

class GITSWorkerService
    public list PublicWorker(DataAreaId _company)
        List WorkerList = new List(Types::Class);
        GITSWorkerList              GITSWorkerList;
        PurchRFQCaseTable           RFQCaseTable;
        DAP_Worker                  DAP_Worker;
            while select DAP_Worker
                GITSWorkerList= new GITSWorkerList();
            return WorkerList;


Now create a service "GITSWorkerService"
Set the external name "GITSWorkerService"
And Description "Worker"
And class name property "GITSWorkerService"

[Note: Soap > XML]

Now create a service operation in the service and select the method as "PublicWorker" and the name of the operation as same

Now create a service group "GITSWorkerServiceGroup" and set auto-deploy property to "Yes"
Now create a service in the service group "GITSWorkerService" and set the service "GITSWorkerService"

Link to access the service
REST {JSON,XML}access:
Note: OData also comes under REST services

Soap {Only XML}access:

Sunday, December 4, 2022

How to create a key vault in Azure

Go to Azure Portal

Click on "Create a resource"

Now in the search, search for "Key vault"

Now click on create,

A new form will open up, like below

Fill in the details as shown in the picture below,

Now click on "Review and create", a new window will open like below

Go to the resource created, you will see a window like the one below,

Now go to "Secrets"

Now click on "Generate/Import" as shown in the picture above, a new window will open like the one below, fill in the Name and secret value that you want to save and click on create

Now you can see the secret stored in the Key vault as shown below


How to send a message in Service bus via service bus explorer

 Download Service bus explorer from the Link

Extract the zip file and Run the "Service bus explorer" as shown in the picture

"Service bus explorer" will be opened and will look like below, Now click on file connect

A new window will open like below

Go to the service bus, and Shared access policy, as shown in the picture

Copy the primary key,

Fill in the details in "Service bus explorer", like below

Click Ok

You will see all the topics and Queues on the left side panel, right click on it and select "Select messages"

Now click on select files, like below, and select the file that you want to send in the bus or topic

Now click "Start", it will send the required file to the Topics, that you want


Tuesday, November 29, 2022

How to create a service bus in Azure portal

Go to Azure portal: Azure

Click on "Create a resource"

Now search in the bar "Service bus" and select "Service Bus" as shown in the picture

A new window will popup like below

Click on create, and a new window will open like below

Now fill in the details like below,
Create a Resource group in my case I have created: DynamicsCommunity101RG
Give a Namespace name: DynamicsCommunity101ServiceBus
Select Premium or Standard pricing, because in the Basic, you won't be able to create Topics

Now click on "Review and Create", Now once the validation is passed, click on create

The deployment will be initialized, Once the Deployment is complete
Go to the Service bus, and you will see a screen like below

Now go to Topic in the left panel as shown in the picture,

Now click on "Topic" to create a topic

a new window will popup like the picture below

Now fill in the details like shown in the picture below

Now go to Topic, and inside topic go to subscriptions as shown in the picture below

After going to the subscription, you will see like below picture,

Now click on Subscription to create a subscription

A new window will open like below

Now fill in the name and Max delivery count, and click on create as shown in the picture below

A new subscription will be created

Now go to Service bus that we created, then "Shared access policies", and create a policy by clicking add as shown in the picture

Now a new form will pop up, fill in the name and click on manage as shown in the picture

Now click on create, Now a shared access policy will  be created

Save, Now copy the primary connections string, and save it in a key vault

How to create a key vault

Friday, November 25, 2022

Difference between Power Automate and Logic Apps

Power automate:
1. It is available as part of O365 applications
2. Power automate is a browser-based application which means you can modify it only using the browser
3. Microsoft Flow can be accessed and modified in a Mobile app
4. For Power Automate, either you pay on a per-flow or per-user basis.
5. If you have a relatively simple application to create then you should go for Power Automate.
6. If your application is using Office 365 / Dynamics application then you can probably pick Power Automate.
7. If Citizen Developers are creating the application, you can go with Power Automate.

Logic apps:
1. Logic apps is a part of the Azure platform
2. You can work with Logic apps in a browser as well as in a visual studio designer.
3. Logic Apps cannot be operated from a mobile app
4. For Logic Apps you pay as you use. That means whenever Logic apps run, connectors, triggers, and actions are metered and based on that the user is charged.
5. If you want to create an application that has complicated requirements then you should go for Logic Apps
6. If your application is mostly using Azure services, then you can go ahead with Azure Logic Apps 
7. If Pro developers are working, then you can go ahead with Logic Apps without any hesitation.

Thursday, November 24, 2022

Azure Service Bus


Azure Service Bus is a fully managed enterprise message broker with message queues and publish-subscribe topics (in a namespace). Service Bus is used to decouple applications and services from each other, providing the following benefits:

Summary: Data is transferred between different applications and services using messages. A message is a container decorated with metadata and contains data. The data can be any kind of information, including structured data encoded with common formats such as the following ones: JSON, XML, Apache Avro, and Plain Text.


Messages are sent to and received from queues. Queues store messages until the receiving application is available to receive and process them.
Messages in queues are ordered and timestamped on arrival. Once accepted by the broker, the message is always held durably in triple-redundant storage, spread across availability zones if the namespace is zone-enabled. Service Bus never leaves messages in memory or volatile storage after they've been reported to the client as accepted.
Messages are delivered in pull mode, only delivering messages when requested. Unlike the busy-polling model of some other cloud queues, the pull operation can be long-lived and only complete once a message is available.


You can also use topics to send and receive messages. While a queue is often used for point-to-point communication, topics are useful in publish/subscribe scenarios.
Topics can have multiple, independent subscriptions, which attach to the topic and otherwise work exactly like queues from the receiver side. A subscriber to a topic can receive a copy of each message sent to that topic. Subscriptions are named entities. Subscriptions are durable by default but can be configured to expire and then be automatically deleted. Via the Java Message Service (JMS) API, Service Bus Premium also allows you to create volatile subscriptions that exist for the duration of the connection.
You can define rules on a subscription. A subscription rule has a filter to define a condition for the message to be copied into the subscription and an optional action that can modify message metadata. For more information, see Topic filters and actions. This feature is useful in the following scenarios:
You don't want a subscription to receive all messages sent to a topic.
You want to mark up messages with extra metadata when they pass through a subscription

Some Termonologies for this blog :

1. Messaging: Transfer business data, such as sales or purchase orders, journals, or inventory movements.

2. Namespaces: A namespace is a container for all messaging components (queues and topics). Multiple queues and topics can be in a single namespace, and namespaces often serve as application containers.
A namespace can be compared to a server in the terminology of other brokers, but the concepts aren't directly equivalent. A Service Bus namespace is your own capacity slice of a large cluster made up of dozens of all-active virtual machines. It may optionally span three Azure availability zones. So, you get all the availability and robustness benefits of running the message broker at an enormous scale. And, you don't need to worry about underlying complexities. Service Bus is serverless messaging.

3. Decouple applications: Improve the reliability and scalability of applications and services. Producers and consumers don't have to be online or readily available at the same time. The load is leveled such that traffic spikes don't overtax a service.

4. Load balancing: Allow for multiple competing consumers to read from a queue at the same time, each safely obtaining exclusive ownership of specific messages.

5. Topics and subscriptions: Enable 1:n relationships between publishers and subscribers, allowing subscribers to select particular messages from a published message stream.

6. Transactions: Allows you to do several operations, all in the scope of an atomic transaction. For example, the following operations can be done in the scope of a transaction.
Obtain a message from one queue.
Post results of processing to one or more different queues.
Move the input message from the original queue.
The results become visible to downstream consumers only upon success, including the successful settlement of the input message, allowing for once-only processing semantics. This transaction model is a robust foundation for the compensating transactions pattern in the greater solution context.

7. Message sessions: Implement high-scale coordination of workflows and multiplexed transfers that require strict message ordering or message deferral.
If you're familiar with other message brokers like Apache ActiveMQ, Service Bus concepts are similar to what you know. As Service Bus is a platform-as-a-service (PaaS) offering, a key difference is that you don't need to worry about the following actions. Azure takes care of those chores for you.
Worrying about hardware failures
Keeping the operating systems or the products patched
Placing logs and managing disk space
Handling backups
Failing over to a reserve machine

8. Advanced features: Service Bus also has advanced features that enable you to solve more complex messaging problems. The following sections describe these key features:

9. Message sessions: To realize a first-in, first-out (FIFO) guarantee in Service Bus, use sessions. Message sessions enable joint and ordered handling of unbounded sequences of related messages.

10. Auto-forwarding: The auto-forwarding feature enables you to chain a queue or subscription to another queue or topic that is part of the same namespace. When auto-forwarding is enabled, Service Bus automatically removes messages that are placed in the first queue or subscription (source) and puts them in the second queue or topic (destination).

11. Dead-lettering: Service Bus supports a dead-letter queue (DLQ) to hold messages that cannot be delivered to any receiver, or messages that cannot be processed. You can then remove messages from the DLQ and inspect them.

12. Scheduled delivery: You can submit messages to a queue or topic for delayed processing. For example, to schedule a job to become available for processing by a system at a certain time.

13. Message deferral: When a queue or subscription client receives a message that it's willing to process, but for which processing isn't currently possible because of special circumstances within the application, the entity can defer retrieval of the message to a later point. The message remains in the queue or subscription, but it's set aside.

14. Transactions: A transaction groups two or more operations together into an execution scope. Service Bus supports grouping operations against a single messaging entity (queue, topic, subscription) within the scope of a transaction.

15. Filtering and actions: Subscribers can define which messages they want to receive from a topic. These messages are specified in the form of one or more named subscription rules. For each matching rule condition, the subscription produces a copy of the message, which may be differently annotated for each matching rule.

16. Auto-delete on idle: Auto-delete on idle enables you to specify an idle interval after which the queue is automatically deleted. The interval is reset when there is traffic on the queue. The minimum duration is 5 minutes.

17. Duplicate detection: If an error occurs that causes the client to have any doubt about the outcome of a send operation, duplicate detection takes the doubt out of these situations by enabling the sender to resend the same message, and the queue or topic discards any duplicate copies.

18. Shared access signature (SAS): Role-based access control, and managed identities
Service Bus supports security protocols such as Shared Access Signatures (SAS), Role Based Access Control (RBAC), and Managed identities for Azure resources.

19. Geo-disaster recovery: When Azure regions or datacenters experience downtime, Geo-disaster recovery enables data processing to continue operating in a different region or datacenter.

20. Security: Service Bus supports standard Advanced Message Queuing Protocol (AMQP) 1.0 and HTTP/REST protocols.

Wednesday, November 23, 2022

How to use Postman with Dynamics 365 FO

 To use postman in Dynamics basically, we need to follow 2 steps:

1. Register the app in the Azure portal.

How to register Azure app for Dynamics 365 FO

2. Connection with the postman :

Download and install postman from the following link: Download

Open postman and click on new

A new popup window will open, select "Collections"

Name it as per your needs, in my case, I am renaming as "Dynamics 365 F&O"

Now click on Type and select OAuth 2.0

A new form will pop up, fill in the following information

Callback URL: Dynamics 365 F&O URL
Auth URL:
Auth URL = A + B
where A:
and B: Dynamics 365 F&O URL
Access token URL: You may take from the azure app you just created in the First step
Client ID will be the Application ID from the Azure portal

Now click on "Get new access token"
It should ask for your credentials, fill in the details and an access token will be generated, like below

Click on "Use Token"
Now click on "Add a request"

Now a new form will open like below

Now we are testing using a "GET" request for the Customer group data entity
Fill in the mentioned area like in the below picture, and replace {{URL}} with your Dynamics 365 F&O URL

Now click "Send". You will get the data like below

Now for the "POST" request, select the "Post" like below

Now go to "Headers" and create new content-Type = application/json

Now go to Body, select raw, and then select Text, put in the data that we want to send to dynamics 365 F&O, and click "Send"

Data sent to Dynamics 365 F&O