Azure / Azure/azure-cli

az mysql flexible-server create creates server that cannot connect into

Open
#30,968 4 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad Auto-Assign bug customer-reported MySQL Service Attention Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

The command ` az mysql flexible-server create` creates a server in a state that `mysql` client cannot connect into. This is done in a Azure DevOps pipeline.

Here is the full script:

```
az mysql flexible-server create --resource-group $resourcegroup \
--name $sername \
--location $location \
--admin-user $adminusername \
--admin-password $adminpassword \
--sku-name $sku \
--version $mysqlversion \
--yes \
--tags CreatedBy=AzDO

az mysql flexible-server firewall-rule create --resource-group $resourcegroup \
--name $sername \
--rule-name AllowAllIPs \
--start-ip-address 0.0.0.0 \
--end-ip-address 255.255.255.255

#THIS LINE WORKS. MEANING SERVER IS CREATED AND THIS COMMAND DOESN'T FAIL
az mysql flexible-server connect -n $sername -u $adminusername -p $adminpassword -d flexibleserverdb

#THIS FOLLOWING LINE FAILS WITH CONECTION REFUSED ERROR
#IDENTICAL SETUP CREATED MANUALLY WORKS
#ANY MYSQL COMMAND FAILS

mysql --host=$sername.mysql.database.azure.com \
--user=$adminusername@$sername \
--password=$adminpassword \
--execute="DROP DATABASE IF EXISTS flexibleserverdb;"

mysql --host=$sername.mysql.database.azure.com \
--user=$adminusername@$sername \
--password=$adminpassword \
--ssl-mode=REQUIRED \
--execute="CREATE DATABASE $dbname;"
```

### Related command

az mysql flexible-server create

### Errors

Connection refused or connection error

### Issue script & Debug output

Connection refused or connection error

### Expected behavior

`mysql` client should be able to connect and run commands

### Environment Summary

azure-cli 2.70.0
mysql version 8.0

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.