Thursday, March 22, 2018

App Service Backup Fails when Including Azure MySQL DB

The application itself is running just fine on this DB string, but when including the Azure MySQL database in the App Service backup configuration, the backup fails.

Log Details:
MySql backup exited with code 2 for db:1cdda146. Output: mysqldump: Got error: 9002: The server name you tried cannot be found. Please use the correct name and retry. Please check your server name bdef0f98dd83a7ff16432ffc1c54394. when trying to connect

App Service Connect string:
Database=1cdda146;Data Source=bdef0f98dd83a7ff16432ffc1c54394.mysql.database.azure.com;User Id=c35e433d7a@bdef0f98dd83a7ff16432ffc1c54394;Password=<pw>

The DB name here is made up to match the example - the DB resource name is 31 chars. 
I can add another connection string with a different database - 29 chars, and that works. 

There also appears to be a lag in the App Service backup pulling the changes in the connection strings. If you change the settings for connection string N and immediately go run a backup, the old settings appear to be used. 

I've not found anywhere to point a finger at on this, yet. The log entry has a truncated server name. 

Next up I'll try making two new Azure MySQL DBs with 31 and 20 chars, to test my theory.

Update 1:
The new 31 char and 20 char DBs both back up fine. I guess I'll just make a new Azure MySQL DB and migrate schemas it.