azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[QUERY] [MySQL] Not able to set up Authentication when using MySql SDK

Open wimeling opened this issue 2 years ago • 5 comments

Library name and version

Azure.ResourceManager.MySql 1.0.0

Query/Question

When creating a MySql Flexible Server via de SDK in c#. I should be able to set the following settings:

image

I am using the CreateOrUpdateAsync method to create a Mysql Flexible server, As you can see in the code I add a user assigned managed identity when creating the database. But the problem is that when creating the database there is no option to set the option Assign access to and this is also not set the right way when creating the database with user assigned managed identity in the call.

Another issue is that there does not seem to be an option to set the Azure Active Directory Administrators (Azure AD Admins) via the code. I have looked at the azure cli option for create a MySql Flexible server and there is the option to do az mysql flexible-server ad-admin create But I cannot find any option when using the SDK

image

Can you assist me in making sure the settings for Authentication can be set through the c# sdk

Environment

.NET SDK: Version: 7.0.100 Commit: e12b7af219

Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.100\

Host: Version: 7.0.0 Architecture: x64 Commit: d099f075e4

IDE: Microsoft Visual Studio Enterprise 2022 (64-bit) - Preview Version 17.5.0 Preview 1.0

wimeling avatar Jan 04 '23 09:01 wimeling

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Jan 04 '23 13:01 jsquire

Hi @wimeling , I'm not seeing this page in Azure portal image there is only user assigned identity setting in portal when creating my sql flexible server image

may I know in which page you are seeing the authentication?

xboxeer avatar Jan 06 '23 07:01 xboxeer

The page I am talking about can be found here:

image It seems that these options are not available when creating the Flexible server resource. But when the resource is created then you have these options. And I would like to know how to enable the settings on this page via the SDK in C# code.

wimeling avatar Jan 06 '23 07:01 wimeling

The assign access to is a UI convenience option in portal, it does not have a corresponding property in SDK or REST API level. You can validate it by assigning a user assigned managed identity in the authentication page, retrieve that mysql resource in SDK and check the Data.Identity property

xboxeer avatar Jan 10 '23 01:01 xboxeer

Hi xboxeer,

So if I understand correctly for this part of the UI, there is no way to programmatically adjust this setting to MySql and Azure Active Directory authentication? Is this something I can expect in the future?

image

For this part of the UI I have found the code to update the setting, I can use the Identity property in the

image

That leaves me with the last part of my question and that is how to set Azure Active Directory Administrators part. Like I told you in the original question it seems that there is a az mysql flexible-server ad-admin create option in the Azure CLI which uses the Azure ResourceManager api if I am correct. So my question still is how can I set this part through code via de SDK?

image

wimeling avatar Jan 10 '23 08:01 wimeling

Hello, can I maybe get some more assistance on this issue?

wimeling avatar Jan 16 '23 09:01 wimeling

I have checked the azure cli command az mysql flexible-server ad-admin create and this creates the following call: PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.DBforMySQL/flexibleServers/{server}/administrators/ActiveDirectory?api-version=2021-12-01-preview So the call seems to be available in the api. Can you tell me when this will be available in the sdk for the MySql Flexible server?

wimeling avatar Jan 17 '23 15:01 wimeling

Hi @wimeling, sorry for the delay of response and thanks for your finding. Currently the API version of the FlexibleServer in our SDK is 2021-05-01 and the feature that you are asking is introduced in 2021-12-01-preview, which means we need an update in SDK side. I'm working on the API version bump and I assume the release should be early Feb.

Yao725 avatar Jan 18 '23 06:01 Yao725

Hi @wimeling , the feature for MySQL SDK has been released, please check the leatest version.

HarveyLink avatar Feb 21 '24 06:02 HarveyLink