我正在尝试以编程方式将新的 MySQL
数据库实例添加到 Azure 门户。
我查看了这个库:https://github.com/Azure/azure-libraries-for-net
,但我只看到了如何创建SQL Server<的示例
而不是 MySQL
。
var credentials = SdkContext.AzureCredentialsFactory.FromFile(Environment.GetEnvironmentVariable("AZURE_AUTH_LOCATION"));
var azure = Azure
.Configure()
.WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
.Authenticate(credentials)
.WithDefaultSubscription();
var sqlServer = azure.SqlServers.Define(sqlServerName)
.WithRegion(Region.USEast)
.WithNewResourceGroup(rgName)
.WithAdministratorLogin(AdministratorLogin)
.WithAdministratorPassword(AdministratorPassword)
.WithNewFirewallRule(FirewallRuleIPAddress)
.WithNewFirewallRule(FirewallRuleStartIPAddress, FirewallRuleEndIPAddress)
.Create();
var database = sqlServer.Databases
.Define(DatabaseName)
.Create();
知道它是否也支持以编程方式创建 MySQL
服务器吗?
最佳答案
查看发行说明和 SDK 代码,似乎仍然不支持管理 MySQL
数据库的功能(从版本 1.3 开始)。
你可以做的就是使用 REST API for managing Azure MySQL databses
直接地。创建数据库请查看Create Or Update Database
操作。
要开始使用 Azure REST API,您可能会发现此链接很有用:https://learn.microsoft.com/en-us/rest/api/ .
关于c# - Azure - 以编程方式添加新的 MySQL 数据库实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47249981/