close

Azure App Service

Microsoft Azure App Service

Azure App Service

How to connect to the MySQL database for WordPress WebApp in Azure App Services

How to connect to the MySQL database for WordPress WebApp in Azure App Services

As we all know that WordPress is one of the most popular CMS (Content Management Systems) available in the world. It’s the no. 1 content management system where Joomla and Drupal comes distance 2nd and 3rd. More details about the CMS can be found here.

As per the wordpress.org the WordPress websites contains around 25% of all the websites available in the internet. Azure WebApp is providing the WordPress web hosting as a PaaS service. When we choose the WebApp for WordPress it will create a MySQL.

Azure AppService now provide two types of WordPress Hosting one is the default WordPress

And the second one is WordPress on Linux which is still on Preview (Released in March this year)

Whatever the option we choose the MySQL database is provided by the ClearDB, not Microsoft.

Recently I have been requested by few users to fix some records in the tables of the MySQL database of the WordPress WebApp hosted in Azure. I will show you how we can connect to the MySQL DB from our workstation.

Generally if you have an Azure WebApp with Custom Domain the minimum default plan which is available is the D1 shared plan. More details about the Azure WebApp plan is available here.

To connect to the MySQL database first I need to go the Application App Service, click on overview and click on the Get publish profile button.

Once the published profile settings is downloaded I have opened it in the notepad or any other text editor. It will show the name of the MySQL database, username and password information as shown below.

Now once I got the MySQL database name, Username and password, I should be able to connect to the MySQL database.

To connect to the MySQL database I need to download the MySQL client which is called MySQLWorkBench and can be downloaded from the MySQL website here.

Once the MySQLWorkBench is downloaded and installed in my workstation I was able to make a connection to the MySQL database over the port number 3306.

Please make sure port number 3306 is allowed in your organization firewall towards internet.

The MySQL connection settings was looking like this.

Once it is configured I have clicked on connect and supply the credentials and it was able to connect to the MySQL database. To test the connection I have clicked on the Test Connection button as shown below

Once it’s connected I was able to see the following screen.

Above I can find the default tables created by WordPress. That’s all about today, I hope this post will help you in the WordPress deployment in future. Good Luck with your Azure App Service.

read more
Azure App Service

Troubleshooting Azure WordPress Web App login issue

WordPressloginissue

Recently I have faced a strange issue with one of the WordPress web app hosted in Azure. It was very strange since some of the other WordPress sites hosted in the same subscription were working fine and the other .net web apps are also working fine.

Since the issue was related to wrong configuration in the WordPress side related to custom domain, before I start more on the detailing of this issue, I would like to show you, how I have initially configured the custom domain for this WordPress site.

Although there are multiple articles in the internet available showing you how to configure your custom domain name with the Azure Web sites, however I will still try to narrate here what I have done to achieve this configuration in simple three easy steps and how I have resolved the WordPress login issue.

Like mentioned in many blogs as well as the Microsoft website I have followed

Step 1:

Go to my web app and check the URL of the website, I’ll try to browse this URL and make sure everything is working fine. Also make I’ll make sure that the pricing tier is correct.

Step 2:

Login to the GoDaddy portal (The custom domain was purchased from GoDaddy) and login to the manage DNS tab and add the following records in the DNS console.

Step 3:

In this step I’ll go the WordPress WebApp and go the custom domains tab and add the domain.

Once the custom domains are added it was looking like this.

Now up to this everything was fine. I was able to browse the site and everything was working as expected. However after few days of operations I have received calls from few users that they were unable to browse the site, when they typed the URL in the below format.

1) http://customdomainname.com

2) www.customdomainame.com

Although the site was opening fine if I type http://customdomainname.azurewebsites.net

Also the WordPress admin has reported that he was no longer able to login to WordPress website with the admin login.

While troubleshooting first, I went to Azure custom domain settings of the WebApp and then went to GoDaddy DNS console to check if any changes were made by anyone and I have found no changes has been done. So this
issue became critical since the WordPress Admin also unable to login to Admin Console
to check any changes.

The application owners and the developers were thinking it was an Azure infrastructure issue. However since no changes was made on the Azure side or the GoDaddy DNS side, I was sure that there must be some changes done in the WordPress application side which must have caused this issue.

While further researching on the issue I came to know that WordPress saves all the settings related to the site in the wp_options table in the MySQL database in Azure. So I have decided to check that database to understand if there is any changes made on the configuration.

I have downloaded MySQL workbench so that I can login to the MySQL database for this website. Now to question is how we can connect to the MySQL database for the Azure WordPress Website.

I have already written an article which clearly explains that how we can connect to the MySQL database in a shared MySQL instance of the WordPress last week.

Please click this article to know more.

Once I login to MySQL database I have ran the following command

And I have found someone has changed the site URL and the Home page URL to customdomain.azurewebsites.net

Because of this change the site is not opening and the WordPress admin was unable to login. I have reverted back the change to the following.

And things started working from there.

The WordPress Admin has send me the screenshot from the WordPress Admin portal and it looks like the below which is expected.

Conclusion:

To resolve this kind of issues where multiple parties are involved, it is necessary that the Azure Admin should understand how the Azure Web App works and what are the configuration parameters from admin side. A good knowledge on the administration of the Azure Web Apps can resolve this type of issues faster. For the organizations who don’t have the Azure Administrators they may need to open a ticket with MS for this kind of issues and MS will help in resoving them as per the support agreement, since it’s a PAAS offering they may not charge any dollars but there are different SLA involved which may lead up to 8 hrs. of response time which may be unacceptable for the production workloads.

And I think on premise Web Admins still have many things to do in Azure, if they quickly get trained in Azure technologies it is a good change for their career growth.

I hope you have liked this post. I will publish more on Azure App Services in coming days. Have a good day.

read more
Azure App ServiceWindows Server

Microsoft is upgrading the host OS of Azure App Service and Azure Functions to Windows Server 2016

Azure Functions to Windows Server 2016

Microsoft is planning to upgrade App Service and Functions infrastructure to Windows Server 2016. This updates paves the way to allow the HTTP/2 protocol for App Service and Functions. For HTTP/2 support they will send communications when it will be available worldwide. The update will began on Monday, December 4, 2017, and continue through January 2018.

What does it mean for the Azure Administrators and End Users?

Most updates can be performed without affecting your services running on the platform’s infrastructure. However it will automatically restart your App Services. This may happen multiple times during the OS patching. Microsoft monitoring team will be monitoring the health of the platform during the rollout.

Recommended Actions

Test your app in your local environment if you have Windows Server 2016

Alternately you can install IIS in Windows 10 and test your App in Windows 10 environment because Windows 10 shares many components with Windows Server 2016.

read more
Azure App Service

How to create a Hybrid Connection from Azure App Service to on premises SQL Server

hybridcmlayout

When you deploy App Services in Azure sometimes it’s necessary to connect to on premises data sources which may a database server or monitoring server (SCOM) or some other application data. Since your App Service is using a predefined netwok it’s important to use Hybrid connections since Hybrid connections allowed the connectivity with the resources in the other networks.  It used in App Service, each Hybrid Connection correlates to a single TCP host and port combination. This means that the Hybrid Connection endpoint can be on any operating system and any application, provided you are accessing a TCP listening port. 

As per MS the Hybrid connection has the following benefits:

  • Apps can access on-premises systems and services securely.
  • The feature does not require an internet-accessible endpoint.
  • It is quick and easy to set up.
  • Each Hybrid Connection matches to a single host:port combination, helpful for security.
  • It normally does not require firewall holes. The connections are all outbound over standard web ports.
  • Because the feature is network level, it is agnostic to the language used by your app and the technology used by the endpoint.
  • It can be used to provide access in multiple networks from a single app.

As you can see in the point number 4 and 5 hybrid connections are secure since they single host and port combination and generally outbound over the standard web ports.

Production Scenario:

Today I am going to show you how we can create a hybrid connection to a SQL database which is part of a different newtork which is a part of on premises resources.

Fig: Architecture of Hybrid Connection.

As you can see that our SQL server where the App services wants to connect is located in on premises network.

First we need to go to App service and than need to click on the Network tab in the left hand side.

Once you click on the networking tab you can see the following things:

You need to click on the Hybrid connections

The next step is to add hybrid connection

Here you need to give details, Hybrid connection name can be anything you would like to call your hybrid connection, endpoint host is the FQDN of the on premises SQL server name, 1433 is the SQL listening port. Also you need to select the service bus namespace.

Once you submit it will take some time to create.

Once it’s created you can go to properties and see the details.

The last and final step is to view the connection which is just created.

Next, download the Connection Manager using Download Connection Manager. It is basically a download with pre-configured Azure subscription details which, when need to be installed in the on-premises SQL box, acts as a listener to Azure Web App requests.

Once all the hybrid connections are connected you can see below.

That’s all for today.

read more