Saturday, 7 December 2019

The chromedriver.exe or geckodriver.exe file does not exist in Selenium

Selenium Driver Setup


If you are getting an error like "The chromedriver.exe file does not exist in the current directory"
or "geckodriver.exe does not exist"

Step 1:


For Chrome, open the URL mentioned below. Here you need to download chromedriver.exe
You can choose the latest version of this file.

For Firefox, open the URL mentioned below. Here you need to download geckodriver.exe

Step 2: 


After downloading the file, place the .exe file in your project under any directory. 
Note: Location choice is yours.
















Step 3: 


Specify the location in the code.








Step 4: 


If you are working on the console application then you can specify a generic path as shown in the snapshot below.


















Alternate and Easy Step


















Install the chrome driver only as mentioned in the snapshot below. You don't need .exe in this case.
Run the code as shown in the snapshot below















Note: You might get chrome version error. Make sure you have the latest chrome installed or update your browser.

It will open the browser successfully. In the above example, it will open the chrome browser.




Tuesday, 29 October 2019

Azure Data Factory: Copy Data from SQL database to Dynamic365

The below article will provide you step by step instructions to load data from SQL database to dynamic CRM.

Step 1: Go to portal.azure.com
Step 2: Create a new resource and select data factory













Step 3: Press Create button
Step 4: Select name, resource group etc.


















Step 5: Press Create button
Step 6: Once the data factory is created, click on it and press the "Author & Monitor" rectangle.
Step 7: It will open a new window for adf.azure.com















Step 8: Click on Create pipeline tab
Step 9: Drag Copy Data task to the right.


Step 10: The next step is to set Source and Sink. (Sink is destination)
Step 11: Select Source, and press the New button and select the Azure SQL database.













Step 12: Set the properties, In linked Service, Select New option and enter the server name, database, username and password and press create button.



























Step 13: Go to Sink, and press the New button in the Sink Dataset and search for Dynanic365 database and select














Step 14: Edit Dataset and create new linked service















Step 15: Set Service URL, Username and password for dynamic 365. Test  your connection and press the create button.
Step 16: Select the entity named in the dropdown.
Step 17: Go to Pipeline, Select Copy data and press mapping options.
              Click the button Import schema, and check your mappings are as expected. If mapping is not loaded properly the specify manually destination columns.










Step 18: Click on Publish All.
Step 19: Press Debug and it will load the data to Dynamic 365










Now it will start loading the data, If the data and mappings are correct then you will see a success message otherwise you will get a failure message.

This is all about this article. I hope you will like it.

Wednesday, 11 September 2019

Infrastructure As Code: ARM Templates Deployment - Azure Portal

ARM Template Deployment in the Azure Portal


An ARM template is a JSON file used to configure and deploy various Azure resources.

If you want to deploy your ARM(Azure Resource Manager) Template in the Azure Portal then it is very easy. Just open the link https://portal.azure.com and login with your subscription.

Step 1 - Click on Create a resource button on the top left as shown in the snapshot below.








Step 2 - Type "template" in the search box and you will see the Template deployment option, click on that, as shown below.

















Step 3 - Click on the create button as shown below.























Step 4 - Click on the "Build your own template in the editor"

























 Step 5 - Paste your template on the right side and press save.
    




























 Step 6 - Click on the purchase, it will validate and then execute the template. After then you can see the resource has been created.
     






































This is all about the article. thanks for reading it.

Thursday, 5 September 2019

Introduction of Azure Function, Types and Deployment

Azure Function


Azure Functions is the serverless computing service hosted on the Microsoft Azure public cloud.
Serverless computing is a very popular term. In most of the cloud technical sessions and the conference, you will hear this term.

In Serverless, you will still write your server-side logic but, unlike traditional architectures, it’s run in stateless compute containers that are event-triggered.

You use Azure Functions to host small applications, like background jobs or small tasks that only runs for a short period. Just like the Logic Apps, Azure Functions are serverless as they scale automatically and you only pay for them when they run. Its Pay as you go.

Similar Technologies

AWS Lambda
Google Cloud Functions
Open Whisk (IBM)


How Azure Function Works











Below are the prerequisite before creating Azure Function

Active Azure subscription 
Azure Storage account.

The developer creates a function and the required code will be deployed in the cloud.

Function Types

Azure Functions has predefined templates. There are many function types available. However, we will discuss the most common function types.

HTTPTrigger

It triggers the execution by using an HTTP request. You can call the Azure function through an API client like Postman.

TimeTrigger
We use this trigger when we want to run our function on a specific time interval.

BlobTrigger
We use this trigger when we want the azure function to trigger automatically when any file is being uploaded to storage Blob.

QueueTrigger
We use this trigger when we want the azure function to trigger automatically when an entry is being added to the queue.

ServiceBusTrigger
The Azure function runs automatically by listening to message queues.

Create Azure Function in Visual Studio


For creating the project in the Visual Studio, Go to File -> New ->Project

I'm using Visual Studio 2019. Find the azure function in the Project Type "Cloud"
Make sure you have a cloud component installed in visual studio.














After then It will ask you to select Function type and Storage account. Select the browse in a storage account and connect with your Azure Subscription. Azure function needs storage account as it places its default file in the azure blob.


Here in this example, I've selected Time trigger function. By default its set to 5 minutes. You can change the time interval at any point.
















You can implement your logic in the Run method.

Deployment of Azure Function

You can easily deploy your azure function by right click on the project as shown in the snapshot above and click publish button















We have 3 plans available.

Consumption Plan

Azure Functions host is dynamically added and removed based on the number of incoming events. When your function runs, Azure provides all of the necessary computational resources. You don't have to worry about resource management, and you only pay for the time that your code runs.

Premium Plan

When you're using the Premium plan, instances of the Azure Functions host are added and removed based on the number of incoming events just like the Consumption plan.

App Service plan

Run your functions just like your web apps. When you are already using App Service for your other applications, you can run your functions on the same plan at no additional cost.


In my example, I'm selecting a consumption plan. You need to specify your
Function app - Name of your function app.
Subscription - Your azure subscription.
Resource group - Resource groups in Azure is a new approach to group a collection of assets.
Location - Select the global region where you want to create the Azure function.
Azure Storage - Storage to save the files.































Once the published is complete, you can see new App Service and Service plan is being created in the Azure Portal.




When you expand the "demoazurefn", you can see your function there.




Once you run the azure function, you see the log in the screenshot below. It means function ran successfully.





















You can also create the azure function in the Azure Portal itself. Please follow below to create the azure function in the portal

Create Azure Function in the Azure portal.


Step 1: Click on the "Create a resource" button and search "function app"
Step 2: Click on the create button on the next page.











Step 3: Select the Function App Name, Resource Group, Storage etc as shown in the snapshot below and click create.

























Step 4: Once you press the create, the system will validate all the details and create the function app in the Azure portal.
Step 5: Function app is ready now, and it's empty. You can now add your function in the function app by clicking the + button as shown below.
















This is all about the azure function, hope you like it.

Friday, 3 May 2019

Check SQL Database size


SQL Query to calculate database size


Below is the query to check the disk space.


SELECT      sys.databases.name as DBName,
            CONVERT(VARCHAR,SUM(size)*8/1024)+' MB' AS [Disk Size]
FROM        sys.databases 
JOIN        sys.master_files
ON          sys.databases.database_id=sys.master_files.database_id
GROUP BY    sys.databases.name
ORDER BY    sys.databases.name


How to check log size and clear log


DBCC SQLPERF(logspace)
DBCC LOGINFO


Below is the query to shrink the log. The first parameter is the log name. you can get the name by pressing the right click on the database and click Properties and then select Files Tab. The second parameter is database size in MB

DBCC SHRINKFILE (ReportServer_log, 8);


Implement Authorization in Swagger with Static Value in Header .Net 8

If you want an anonymous user should not run the APIs. To run your API Endpoints From Swagger / Postman / Code the user should pass the head...