Azure / wordpress-linux-appservice

MIT License
113 stars 71 forks source link

Migration crashes if there is a semicolon in a connection string value. #70

Closed bradkovach closed 1 year ago

bradkovach commented 1 year ago

Old app service on windows installations used the semicolon-delimited connection string format for the DB connection string, such as

Database=xxxx;Data Source=xxx.mysql.database.azure.com;User Id=xxx@contoso;Password=xyzzy

Since there is no source code in the repo, I can't tell you what the problem is, but our azure-managed password was starting with a semicolon, so the migration utility's final error said password= (the password was empty).

Once I changed the password to not contain any semicolons, the migration succeeded.

I suspect the migration tool is using string splits on ; and then = to parse the source connection string, but it should have used the same regular expressions used in the wp-config.php files for these template-generated azure instances...

$connectstr_dbhost = preg_replace("/^.*Data Source=(.+?);.*$/", "\\1", $value);
$connectstr_dbname = preg_replace("/^.*Database=(.+?);.*$/", "\\1", $value);
$connectstr_dbusername = preg_replace("/^.*User Id=(.+?);.*$/", "\\1", $value);
$connectstr_dbpassword = preg_replace("/^.*Password=(.+?)$/", "\\1", $value);
rabollin commented 1 year ago

; is used as a delimiter for connection string formation so it is ignoring the password. Is it possible to reset your password?

@saisubodhMSFT - for a quick check if it is feasible to resolve.

bradkovach commented 1 year ago

I ended up resetting the passwords, which is a workaround. The password that caused this issue was automatically generated by Azure so getting this fixed is important.

On Wed, Apr 12, 2023 at 9:21 PM Radhika B @.***> wrote:

; is used as a delimiter for connection string formation so it is ignoring the password. Is it possible to reset your password?

@saisubodhMSFT https://github.com/saisubodhMSFT - for a quick check if it is feasible to resolve.

— Reply to this email directly, view it on GitHub https://github.com/Azure/wordpress-linux-appservice/issues/70#issuecomment-1506276698, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPS3WKAQZWHOUPFMWRSUW3XA5WJ5ANCNFSM6AAAAAAWV56SEI . You are receiving this because you authored the thread.Message ID: @.***>

-- Brad Kovach

saisubodhMSFT commented 1 year ago

@bradkovach , this is now fixed.

bradkovach commented 1 year ago

Awesome job!

rabollin commented 1 year ago

@bradkovach - Can you please confirm if you are able to test this change so that we can close the issue.

saisubodhMSFT commented 1 year ago

Closing this issue.

You can access the updated tool from https://aka.ms/WPmigration