Now we are ready to run the AzCopy command to sync the contents of the below folder with the container.
On executing the command within PowerShell, it will scan the files at the source first, followed by the files in the destination, and will copy the files from the source that are not present in the destination.
Sample Run:-
We can see both the files uploaded in the container.
Now if we try to run the same command as the batch .bat file.
We might encounter the below error – “Server failed to authorize the request. Make sure the value of the Authorization header is formed correctly including the signature”
This is because of the special characters within the SAS token – the signature part, that needs to be escaped.
Security Defaults provides preconfigured security settings such as MFA – Multi-factor authentication for all users, blocking legacy authentication protocols, etc.
Any tenant created on or after 22nd October 2019, will have this setting enabled for default.
An organization with complex security requirements could disable the security defaults and consider using Conditional Access instead.
Provide the appropriate details. (Here we have selected the – Developer tier)
After validation is passed, review and click on Create.
It will take around 30 minutes for the deployment to be finished
After the deployment is successful, we can navigate to it and can find the Gateway URL and Developer portal URL as shown below.
Here we will start with a Blank API.
Specify the display name, name and for Web service URL the URL of Dynamics 365 Web API
Click on +Add operation to add a new operation to the API.
Specify the URL as shown below to fetch all the contacts from Dynamics 365.
The URL of the operation
Right now we will get the 401 error as expected as we have not passed the token expected by the Web API.
Now for the token part for calling the Dynamics 365 API, register the Application in Azure AD, create a new Application User, and assign appropriate security roles to it.
Here we would be defining send-request policy, to generate the Token and pass it in the Authorization header to the Dynamis 365 Web API request.
Select the GET operation, navigate to the Design tab and open the policy code editor for inbound processing
Add the send-request and set-header policy to generate and set the bearerToken
Specify the endpoint URL of OAuth token, client id, client secret of the application registered.
"copy code from the end of the post"
Save the change and let us test the API.
We can see the results as expected.
The other things that can be done are to associate the API with Products, specify Subscription, Security, enable Application Insights, Azure Monitor etc.