Open gabrielspaulino opened 3 weeks ago
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Hi @gabrielspaulino
Is it possible for you to enable logging and check the JSON response of the List after disabling the public access? https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/resourcemanager#enabling-logging
PS: if you paste it in this issue, please redact any sensitive information.
I believe SDK here is directly return what it gets from backend in this JSON. We will need to forward it to backend, if their response is wrong.
PS: if possible, please include version of azure-resourcemanager-mysqlflexibleserver lib
Hi @weidongxu-microsoft
Sorry, logging is already enabled but how can I get the JSON response?
The version of azure-resourcemanager-mysqlflexibleserver lib that I'm using is 1.0.0-beta.2
One thing I found is that the Network class does not have withPublicNetworkAccess
. It could be that changing "publicNetworkAccess" is not supported in api-version of the 1.0.0-beta.2 SDK in Azure MySql backend.
https://github.com/Azure/azure-sdk-for-java/blob/azure-resourcemanager-mysqlflexibleserver_1.0.0-beta.2/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Network.java#L32-L40
If you check latest 1.0.0-beta.5 SDK, the withPublicNetworkAccess
API exists.
https://github.com/Azure/azure-sdk-for-java/blob/azure-resourcemanager-mysqlflexibleserver_1.0.0-beta.5/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Network.java#L39-L59
Where logging goes depends on the logging lib you use, and the config of it.
The output should be something like below:
09:56:01.172 INFO [parallel-10] - {"az.sdk.message":"HTTP request","method":"GET","url":"https://management.azure.com/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/providers/Microsoft.DBforMySQL/locations/westus3/azureAsyncOperation/2ba32795-15b5-4e55-b77b-f77160081a99?api-version=2023-12-30&t=REDACTED&c=REDACTED&s=REDACTED&h=REDACTED","tryCount":1,"Date":"Mon, 26 Aug 2024 01:56:01 GMT","x-ms-client-request-id":"3a2aabae-da0c-4706-942b-9a948077b89b","Accept":"application/json","User-Agent":"azsdk-java-com.azure.resourcemanager.mysqlflexibleserver/1.0.0-beta.5 (21.0.3; Windows 11; 10.0; auto-generated)","redactedHeaders":"Authorization"}
09:56:01.734 INFO [reactor-http-nio-1] - {"az.sdk.message":"HTTP response","statusCode":200,"url":"https://management.azure.com/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/providers/Microsoft.DBforMySQL/locations/westus3/azureAsyncOperation/2ba32795-15b5-4e55-b77b-f77160081a99?api-version=2023-12-30&t=REDACTED&c=REDACTED&s=REDACTED&h=REDACTED","durationMs":562,"content-length":264,"content-length":264,"body":"{\"name\":\"2ba32795-15b5-4e55-b77b-f77160081a99\",\"status\":\"Failed\",\"startTime\":\"2024-08-26T01:55:00.88Z\",\"error\":{\"code\":\"InternalServerError\",\"message\":\"An unexpected error occured while processing the request. Tracking ID: 'de1cc453-a8a6-476d-bece-f96f6b1ef1e9'\"}}"}
I am having problem creating MySql resource on my test subscription (as you can see on above log), hence I cannot verify whether 1.0.0-beta.5 is good on "publicNetworkAccess" in List.
I tested updating to 1.0.0-beta.5 and it is also always returning "Enabled"
Do you see the log?
I got the JSON response from chrome inspector, does this work? It has publicNetworkAccess as "Disabled". Here it is (I removed some information):
{ "responses": [ { "httpStatusCode": 200, "headers": { "Pragma": ---, "X-Content-Type-Options": ---, "x-ms-request-id": ---, "x-ms-ratelimit-remaining-subscription-reads": ---, "x-ms-ratelimit-remaining-subscription-global-reads": ---, "x-ms-correlation-request-id": ---, "x-ms-routing-request-id": ---, "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Cache": "CONFIG_NOCACHE", "X-MSEdge-Ref": ---, "Cache-Control": "no-cache", "Date": "Tue, 27 Aug 2024 20:32:33 GMT" }, "content": { "sku": { "name": "Standard_B1ms", "tier": "Burstable" }, "systemData": { "createdAt": "2024-08-27T20:22:34.4853383Z" }, "properties": { "administratorLogin": ---, "storage": { "storageSizeGB": 20, "iops": 360, "autoGrow": "Enabled", "autoIoScaling": "Enabled", "storageSku": "Premium_LRS", "logOnDisk": "Disabled" }, "version": "8.0.21", "state": "Ready", "fullyQualifiedDomainName": "mysql-sek-test.mysql.database.azure.com", "availabilityZone": "1", "maintenanceWindow": { "customWindow": "Disabled", "dayOfWeek": 0, "startHour": 0, "startMinute": 0 }, "replicationRole": "None", "replicaCapacity": 10, "network": { "publicNetworkAccess": "Disabled" }, "backup": { "backupRetentionDays": 7, "geoRedundantBackup": "Disabled", "earliestRestoreDate": "2024-08-27T20:27:33.2791802+00:00" }, "highAvailability": { "mode": "Disabled", "state": "NotEnabled", "standbyAvailabilityZone": "" }, "privateEndpointConnections": [] }, "location": "East US", "tags": {}, "id": ---, "name": "mysql-sek-test", "type": "Microsoft.DBforMySQL/flexibleServers" }, "contentLength": 1094 } ] }
Finally I get one created in another test subscription.
listByResourceGroup
works fine on my test.
list
also works.
Here is the log
"body":"{\"value\":[{\"sku\":{\"name\":\"Standard_B1ms\",\"tier\":\"Burstable\"},\"systemData\":{\"createdAt\":\"2024-08-28T02:29:06.1401709Z\"},\"properties\":{\"administratorLogin\":\"sqlAdminWeidxu\",\"storage\":{\"storageSizeGB\":20,\"iops\":360,\"autoGrow\":\"Enabled\",\"autoIoScaling\":\"Disabled\",\"storageSku\":\"Premium_LRS\",\"logOnDisk\":\"Disabled\"},\"version\":\"5.7\",\"state\":\"Ready\",\"fullyQualifiedDomainName\":\"mysqlweidxu123.mysql.database.azure.com\",\"availabilityZone\":\"\",\"replicationRole\":\"None\",\"replicaCapacity\":10,\"network\":{\"publicNetworkAccess\":\"Disabled\"}, ...
(note that the response of the List should have { value: [] }
in body)
Test on 1.0.0-beta.5
You may want to check whether the azure-core lib in your app is up-to-date. It handles the de-serialization. https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/resourcemanager#dependency-management
Hi @gabrielspaulino. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
I tried with the following versions:
azure-resourcemanager-mysqlflexibleserver - 1.0.0-beta.5
azure-core - 1.51.0
azure-resourcemanager - 2.42.0
but it didn't work for me utilizing the SDK. When making the request directly for this URL it worked.
https://learn.microsoft.com/en-us/rest/api/mysql/flexibleserver/servers/list?view=rest-mysql-flexibleserver-2023-12-30&tabs=HTTP
Here is the response:
{"value":[{"sku":{"name":"Standard_B1ms","tier":"Burstable"},"systemData":{"createdAt":"2024-08-29T20:56:28.9920341Z"},"properties":{"administratorLogin":---,"storage":{"storageSizeGB":20,"iops":360,"autoGrow":"Enabled","autoIoScaling":"Enabled","storageSku":"Premium_LRS","logOnDisk":"Disabled"},"version":"8.0.21","state":"Ready","fullyQualifiedDomainName":---,"availabilityZone":"2","replicationRole":"None","replicaCapacity":10,"network":{"publicNetworkAccess":"Disabled"},"backup":{"backupRetentionDays":7,"geoRedundantBackup":"Disabled","earliestRestoreDate":"2024-08-29T20:59:43.4578412+00:00"},"highAvailability":{"mode":"Disabled","state":"NotEnabled","standbyAvailabilityZone":""},"privateEndpointConnections":[]},"location":"East US","tags":{},"id":---,"name":"mysql-sek-test","type":"Microsoft.DBforMySQL/flexibleServers"}]}
Describe the bug MySQL Flexible server objects returned by
com.azure.resourcemanager.mysqlflexibleserver.MySqlManager.servers().list()
always return "Enabled" value forServer.innerModel().network().publicNetworkAccess()
Exception or Stack Trace There isn't any exception.
To Reproduce Call method
com.azure.resourcemanager.mysqlflexibleserver.MySqlManager.servers().list()
before and after disabling public access for your MySQL server.Code Snippet
Expected behavior The expected return for
com.azure.resourcemanager.mysqlflexibleserver.models.Server.innerModel().network().publicNetworkAccess()
isPublicNetworkAccessEnum.DISABLED
when public access is disabled in the MySQL serverScreenshots Before disabling public access: After disabling public access:
Setup (please complete the following information):
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report