更新現有伺服器。 要求本文可以包含一對多個存在於一般伺服器定義中的屬性。
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}?api-version=2023-12-30
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
resourceGroupName
|
path |
True
|
string
|
資源群組的名稱。 名稱不區分大小寫。
|
serverName
|
path |
True
|
string
|
伺服器的名稱。
Regex 模式: ^[a-z0-9][-a-z0-9]*(?<!-)$
|
subscriptionId
|
path |
True
|
string
uuid
|
目標訂用帳戶的標識碼。 此值必須是 UUID。
|
api-version
|
query |
True
|
string
|
用於此作業的 API 版本。
|
要求本文
回應
名稱 |
類型 |
Description |
200 OK
|
Server
|
確定
|
202 Accepted
|
|
已接受
標題
Location: string
|
Other Status Codes
|
ErrorResponse
|
描述作業失敗原因的錯誤回應。
|
安全性
azure_auth
Azure Active Directory OAuth2 Flow
類型:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名稱 |
Description |
user_impersonation
|
模擬您的用戶帳戶
|
範例
Update a server
Sample request
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver?api-version=2023-12-30
{
"properties": {
"storage": {
"storageSizeGB": 30,
"iops": 200,
"autoGrow": "Disabled",
"autoIoScaling": "Disabled"
},
"network": {
"publicNetworkAccess": "Disabled"
}
}
}
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms.mysql_flexibleservers import MySQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MySQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="testrg",
server_name="mysqltestserver",
parameters={
"properties": {
"network": {"publicNetworkAccess": "Disabled"},
"storage": {"autoGrow": "Disabled", "autoIoScaling": "Disabled", "iops": 200, "storageSizeGB": 30},
}
},
).result()
print(response)
# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/stable/2023-12-30/examples/ServerUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmysqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8691fbfca8fcdc5a241a0b501c32fd4a76bb0cd/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/stable/2023-12-30/examples/ServerUpdate.json
func ExampleServersClient_BeginUpdate_updateAServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmysqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.ServerForUpdate{
Properties: &armmysqlflexibleservers.ServerPropertiesForUpdate{
Network: &armmysqlflexibleservers.Network{
PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled),
},
Storage: &armmysqlflexibleservers.Storage{
AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled),
AutoIoScaling: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled),
Iops: to.Ptr[int32](200),
StorageSizeGB: to.Ptr[int32](30),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armmysqlflexibleservers.Server{
// Name: to.Ptr("mysqltestserver"),
// Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"),
// Location: to.Ptr("Southeast Asia"),
// Tags: map[string]*string{
// "num": to.Ptr("1"),
// },
// Properties: &armmysqlflexibleservers.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// AvailabilityZone: to.Ptr("3"),
// Backup: &armmysqlflexibleservers.Backup{
// BackupIntervalHours: to.Ptr[int32](24),
// BackupRetentionDays: to.Ptr[int32](7),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.415Z"); return t}()),
// GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled),
// },
// FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"),
// HighAvailability: &armmysqlflexibleservers.HighAvailability{
// Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled),
// State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled),
// },
// MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{
// CustomWindow: to.Ptr("Enabled"),
// DayOfWeek: to.Ptr[int32](1),
// StartHour: to.Ptr[int32](1),
// StartMinute: to.Ptr[int32](0),
// },
// Network: &armmysqlflexibleservers.Network{
// PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled),
// },
// ReplicaCapacity: to.Ptr[int32](10),
// ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone),
// State: to.Ptr(armmysqlflexibleservers.ServerStateReady),
// Storage: &armmysqlflexibleservers.Storage{
// AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled),
// AutoIoScaling: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled),
// Iops: to.Ptr[int32](200),
// StorageSizeGB: to.Ptr[int32](30),
// StorageSKU: to.Ptr("Premium_LRS"),
// },
// Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7),
// },
// SKU: &armmysqlflexibleservers.MySQLServerSKU{
// Name: to.Ptr("Standard_D2ds_v4"),
// Tier: to.Ptr(armmysqlflexibleservers.ServerSKUTierGeneralPurpose),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MySQLManagementFlexibleServerClient } = require("@azure/arm-mysql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
* x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/stable/2023-12-30/examples/ServerUpdate.json
*/
async function updateAServer() {
const subscriptionId =
process.env["MYSQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["MYSQL_RESOURCE_GROUP"] || "testrg";
const serverName = "mysqltestserver";
const parameters = {
network: { publicNetworkAccess: "Disabled" },
storage: {
autoGrow: "Disabled",
autoIoScaling: "Disabled",
iops: 200,
storageSizeGB: 30,
},
};
const credential = new DefaultAzureCredential();
const client = new MySQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"sku": {
"name": "Standard_D2ds_v4",
"tier": "GeneralPurpose"
},
"properties": {
"administratorLogin": "cloudsa",
"storage": {
"storageSizeGB": 30,
"iops": 200,
"autoGrow": "Disabled",
"storageSku": "Premium_LRS",
"autoIoScaling": "Disabled"
},
"version": "5.7",
"state": "Ready",
"fullyQualifiedDomainName": "mysqltestserver.database.mysql.azure.com",
"availabilityZone": "3",
"maintenanceWindow": {
"customWindow": "Enabled",
"dayOfWeek": 1,
"startHour": 1,
"startMinute": 0
},
"replicationRole": "None",
"replicaCapacity": 10,
"network": {
"publicNetworkAccess": "Disabled"
},
"backup": {
"backupRetentionDays": 7,
"backupIntervalHours": 24,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-06-17T06:11:38.4150019+00:00"
},
"highAvailability": {
"mode": "Disabled",
"state": "NotEnabled"
}
},
"location": "Southeast Asia",
"tags": {
"num": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver",
"name": "mysqltestserver",
"type": "Microsoft.DBforMySQL/flexibleServers"
}
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/azureAsyncOperation/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2023-12-30
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/operationResults/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2023-12-30
Update server customer maintenance window
Sample request
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver?api-version=2023-12-30
{
"properties": {
"maintenanceWindow": {
"customWindow": "Enabled",
"dayOfWeek": 1,
"startHour": 8,
"startMinute": 0
}
}
}
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms.mysql_flexibleservers import MySQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_update_with_customer_maintenance_window.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MySQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="testrg",
server_name="mysqltestserver",
parameters={
"properties": {
"maintenanceWindow": {"customWindow": "Enabled", "dayOfWeek": 1, "startHour": 8, "startMinute": 0}
}
},
).result()
print(response)
# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/stable/2023-12-30/examples/ServerUpdateWithCustomerMaintenanceWindow.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmysqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8691fbfca8fcdc5a241a0b501c32fd4a76bb0cd/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/stable/2023-12-30/examples/ServerUpdateWithCustomerMaintenanceWindow.json
func ExampleServersClient_BeginUpdate_updateServerCustomerMaintenanceWindow() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmysqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.ServerForUpdate{
Properties: &armmysqlflexibleservers.ServerPropertiesForUpdate{
MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{
CustomWindow: to.Ptr("Enabled"),
DayOfWeek: to.Ptr[int32](1),
StartHour: to.Ptr[int32](8),
StartMinute: to.Ptr[int32](0),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armmysqlflexibleservers.Server{
// Name: to.Ptr("mysqltestserver"),
// Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"),
// Location: to.Ptr("Southeast Asia"),
// Tags: map[string]*string{
// "num": to.Ptr("1"),
// },
// Properties: &armmysqlflexibleservers.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// AvailabilityZone: to.Ptr("3"),
// Backup: &armmysqlflexibleservers.Backup{
// BackupIntervalHours: to.Ptr[int32](24),
// BackupRetentionDays: to.Ptr[int32](7),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.415Z"); return t}()),
// GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled),
// },
// FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"),
// HighAvailability: &armmysqlflexibleservers.HighAvailability{
// Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled),
// State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled),
// },
// MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{
// CustomWindow: to.Ptr("Enabled"),
// DayOfWeek: to.Ptr[int32](1),
// StartHour: to.Ptr[int32](8),
// StartMinute: to.Ptr[int32](0),
// },
// Network: &armmysqlflexibleservers.Network{
// PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled),
// },
// ReplicaCapacity: to.Ptr[int32](10),
// ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone),
// State: to.Ptr(armmysqlflexibleservers.ServerStateReady),
// Storage: &armmysqlflexibleservers.Storage{
// AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled),
// Iops: to.Ptr[int32](600),
// StorageSizeGB: to.Ptr[int32](100),
// StorageSKU: to.Ptr("Premium_LRS"),
// },
// Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7),
// },
// SKU: &armmysqlflexibleservers.MySQLServerSKU{
// Name: to.Ptr("Standard_D2ds_v4"),
// Tier: to.Ptr(armmysqlflexibleservers.ServerSKUTierGeneralPurpose),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MySQLManagementFlexibleServerClient } = require("@azure/arm-mysql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
* x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/stable/2023-12-30/examples/ServerUpdateWithCustomerMaintenanceWindow.json
*/
async function updateServerCustomerMaintenanceWindow() {
const subscriptionId =
process.env["MYSQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["MYSQL_RESOURCE_GROUP"] || "testrg";
const serverName = "mysqltestserver";
const parameters = {
maintenanceWindow: {
customWindow: "Enabled",
dayOfWeek: 1,
startHour: 8,
startMinute: 0,
},
};
const credential = new DefaultAzureCredential();
const client = new MySQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"sku": {
"name": "Standard_D2ds_v4",
"tier": "GeneralPurpose"
},
"properties": {
"administratorLogin": "cloudsa",
"storage": {
"storageSizeGB": 100,
"iops": 600,
"autoGrow": "Enabled",
"storageSku": "Premium_LRS"
},
"version": "5.7",
"state": "Ready",
"fullyQualifiedDomainName": "mysqltestserver.database.mysql.azure.com",
"availabilityZone": "3",
"maintenanceWindow": {
"customWindow": "Enabled",
"dayOfWeek": 1,
"startHour": 8,
"startMinute": 0
},
"replicationRole": "None",
"replicaCapacity": 10,
"network": {
"publicNetworkAccess": "Enabled"
},
"backup": {
"backupRetentionDays": 7,
"backupIntervalHours": 24,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-06-17T06:11:38.4150019+00:00"
},
"highAvailability": {
"mode": "Disabled",
"state": "NotEnabled"
}
},
"location": "Southeast Asia",
"tags": {
"num": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver",
"name": "mysqltestserver",
"type": "Microsoft.DBforMySQL/flexibleServers"
}
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/azureAsyncOperation/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2023-12-30
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/operationResults/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2023-12-30
Update server with byok
Sample request
PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver?api-version=2023-12-30
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": {}
}
},
"properties": {
"dataEncryption": {
"type": "AzureKeyVault",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity",
"primaryKeyURI": "https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity",
"geoBackupKeyURI": "https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a"
}
}
}
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.rdbms.mysql_flexibleservers import MySQLManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-rdbms
# USAGE
python server_update_with_byok.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MySQLManagementClient(
credential=DefaultAzureCredential(),
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
)
response = client.servers.begin_update(
resource_group_name="testrg",
server_name="mysqltestserver",
parameters={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": {}
},
},
"properties": {
"dataEncryption": {
"geoBackupKeyURI": "https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a",
"geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity",
"primaryKeyURI": "https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a",
"primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity",
"type": "AzureKeyVault",
}
},
},
).result()
print(response)
# x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/stable/2023-12-30/examples/ServerUpdateWithBYOK.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmysqlflexibleservers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8691fbfca8fcdc5a241a0b501c32fd4a76bb0cd/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/stable/2023-12-30/examples/ServerUpdateWithBYOK.json
func ExampleServersClient_BeginUpdate_updateServerWithByok() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmysqlflexibleservers.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.ServerForUpdate{
Identity: &armmysqlflexibleservers.MySQLServerIdentity{
Type: to.Ptr(armmysqlflexibleservers.ManagedServiceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]any{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": map[string]any{},
},
},
Properties: &armmysqlflexibleservers.ServerPropertiesForUpdate{
DataEncryption: &armmysqlflexibleservers.DataEncryption{
Type: to.Ptr(armmysqlflexibleservers.DataEncryptionTypeAzureKeyVault),
GeoBackupKeyURI: to.Ptr("https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a"),
GeoBackupUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity"),
PrimaryKeyURI: to.Ptr("https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a"),
PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Server = armmysqlflexibleservers.Server{
// Name: to.Ptr("mysqltestserver"),
// Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"),
// ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"),
// Location: to.Ptr("Southeast Asia"),
// Tags: map[string]*string{
// "num": to.Ptr("1"),
// },
// Properties: &armmysqlflexibleservers.ServerProperties{
// AdministratorLogin: to.Ptr("cloudsa"),
// AvailabilityZone: to.Ptr("1"),
// Backup: &armmysqlflexibleservers.Backup{
// BackupIntervalHours: to.Ptr[int32](24),
// BackupRetentionDays: to.Ptr[int32](7),
// EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.415Z"); return t}()),
// GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled),
// },
// FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"),
// HighAvailability: &armmysqlflexibleservers.HighAvailability{
// Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeZoneRedundant),
// StandbyAvailabilityZone: to.Ptr("3"),
// State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateHealthy),
// },
// MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{
// CustomWindow: to.Ptr("Disabled"),
// DayOfWeek: to.Ptr[int32](0),
// StartHour: to.Ptr[int32](0),
// StartMinute: to.Ptr[int32](0),
// },
// Network: &armmysqlflexibleservers.Network{
// PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled),
// },
// ReplicaCapacity: to.Ptr[int32](10),
// ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone),
// State: to.Ptr(armmysqlflexibleservers.ServerStateReady),
// Storage: &armmysqlflexibleservers.Storage{
// AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled),
// Iops: to.Ptr[int32](600),
// StorageSizeGB: to.Ptr[int32](100),
// StorageSKU: to.Ptr("Premium_LRS"),
// },
// Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7),
// },
// SKU: &armmysqlflexibleservers.MySQLServerSKU{
// Name: to.Ptr("Standard_D2ds_v4"),
// Tier: to.Ptr(armmysqlflexibleservers.ServerSKUTierGeneralPurpose),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MySQLManagementFlexibleServerClient } = require("@azure/arm-mysql-flexible");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
*
* @summary Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
* x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/stable/2023-12-30/examples/ServerUpdateWithBYOK.json
*/
async function updateServerWithByok() {
const subscriptionId =
process.env["MYSQL_SUBSCRIPTION_ID"] || "ffffffff-ffff-ffff-ffff-ffffffffffff";
const resourceGroupName = process.env["MYSQL_RESOURCE_GROUP"] || "testrg";
const serverName = "mysqltestserver";
const parameters = {
dataEncryption: {
type: "AzureKeyVault",
geoBackupKeyURI: "https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a",
geoBackupUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity",
primaryKeyURI: "https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a",
primaryUserAssignedIdentityId:
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/ffffffffFfffFfffFfffFfffffffffff/resourceGroups/testrg/providers/MicrosoftManagedIdentity/userAssignedIdentities/testIdentity":
{},
},
},
};
const credential = new DefaultAzureCredential();
const client = new MySQLManagementFlexibleServerClient(credential, subscriptionId);
const result = await client.servers.beginUpdateAndWait(resourceGroupName, serverName, parameters);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"sku": {
"name": "Standard_D2ds_v4",
"tier": "GeneralPurpose"
},
"properties": {
"administratorLogin": "cloudsa",
"storage": {
"storageSizeGB": 100,
"iops": 600,
"autoGrow": "Enabled",
"storageSku": "Premium_LRS"
},
"version": "5.7",
"state": "Ready",
"fullyQualifiedDomainName": "mysqltestserver.database.mysql.azure.com",
"availabilityZone": "1",
"maintenanceWindow": {
"customWindow": "Disabled",
"dayOfWeek": 0,
"startHour": 0,
"startMinute": 0
},
"replicationRole": "None",
"replicaCapacity": 10,
"network": {
"publicNetworkAccess": "Enabled"
},
"backup": {
"backupRetentionDays": 7,
"backupIntervalHours": 24,
"geoRedundantBackup": "Disabled",
"earliestRestoreDate": "2021-06-17T06:11:38.4150019+00:00"
},
"highAvailability": {
"mode": "ZoneRedundant",
"state": "Healthy",
"standbyAvailabilityZone": "3"
}
},
"location": "Southeast Asia",
"tags": {
"num": "1"
},
"id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver",
"name": "mysqltestserver",
"type": "Microsoft.DBforMySQL/flexibleServers"
}
Azure-AsyncOperation: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/azureAsyncOperation/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2023-12-30
Location: https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DBforMySQL/locations/southeastasia/operationResults/e276a03a-1770-4549-86f5-0edffae8997c?api-version=2023-12-30
定義
Backup
伺服器的記憶體配置檔屬性
名稱 |
類型 |
預設值 |
Description |
backupIntervalHours
|
integer
|
|
伺服器的備份間隔時數。
|
backupRetentionDays
|
integer
|
|
伺服器的備份保留天數。
|
earliestRestoreDate
|
string
|
|
最早的還原點建立時間 (ISO8601 格式)
|
geoRedundantBackup
|
EnableStatusEnum
|
Disabled
|
是否啟用異地備援備份。
|
createdByType
建立資源的身分識別類型。
名稱 |
類型 |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
CreateMode
建立新 MySQL 伺服器的模式。
名稱 |
類型 |
Description |
Default
|
string
|
|
GeoRestore
|
string
|
|
PointInTimeRestore
|
string
|
|
Replica
|
string
|
|
DataEncryption
Cmk 的日期加密。
名稱 |
類型 |
Description |
geoBackupKeyURI
|
string
|
異地備份密鑰 URI,因為密鑰保存庫無法跨區域,需要在與異地備份相同的區域中使用 Cmk
|
geoBackupUserAssignedIdentityId
|
string
|
異地備份使用者身分識別資源標識符,因為身分識別無法跨區域,需要與異地備份相同的區域中的身分識別
|
primaryKeyURI
|
string
|
主鍵 URI
|
primaryUserAssignedIdentityId
|
string
|
主要使用者身分識別資源標識碼
|
type
|
DataEncryptionType
|
密鑰類型:適用於 enable cmk 的 AzureKeyVault、適用於停用 cmk 的 SystemManaged。
|
DataEncryptionType
密鑰類型:適用於 enable cmk 的 AzureKeyVault、適用於停用 cmk 的 SystemManaged。
名稱 |
類型 |
Description |
AzureKeyVault
|
string
|
|
SystemManaged
|
string
|
|
EnableStatusEnum
列舉,指出值是否為 'Enabled' 或 'Disabled'
名稱 |
類型 |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|
ErrorAdditionalInfo
資源管理錯誤其他資訊。
名稱 |
類型 |
Description |
info
|
object
|
其他資訊。
|
type
|
string
|
其他信息類型。
|
ErrorDetail
錯誤詳細數據。
名稱 |
類型 |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
錯誤其他資訊。
|
code
|
string
|
錯誤碼。
|
details
|
ErrorDetail[]
|
錯誤詳細資料。
|
message
|
string
|
錯誤訊息。
|
target
|
string
|
錯誤目標。
|
ErrorResponse
錯誤回應
HighAvailability
伺服器的高可用性屬性
HighAvailabilityMode
伺服器的高可用性模式。
名稱 |
類型 |
Description |
Disabled
|
string
|
|
SameZone
|
string
|
|
ZoneRedundant
|
string
|
|
HighAvailabilityState
伺服器高可用性的狀態。
名稱 |
類型 |
Description |
CreatingStandby
|
string
|
|
FailingOver
|
string
|
|
Healthy
|
string
|
|
NotEnabled
|
string
|
|
RemovingStandby
|
string
|
|
ImportSourceProperties
匯入來源相關屬性。
名稱 |
類型 |
Description |
dataDirPath
|
string
|
記憶體中資料目錄的相對路徑。
|
sasToken
|
string
|
用來存取來源記憶體的 Sas 令牌。 SAS 令牌需要讀取和列出許可權。
|
storageType
|
ImportSourceStorageType
|
匯入來源的儲存類型。
|
storageUrl
|
string
|
匯入來源記憶體的 URI。
|
ImportSourceStorageType
匯入來源的儲存類型。
名稱 |
類型 |
Description |
AzureBlob
|
string
|
|
MaintenanceWindow
伺服器的維護期間。
名稱 |
類型 |
Description |
customWindow
|
string
|
指出是否啟用或停用自定義視窗
|
dayOfWeek
|
integer
|
維護時段的星期數
|
startHour
|
integer
|
維護時段的開始時間
|
startMinute
|
integer
|
維護時段的開始分鐘
|
ManagedServiceIdentityType
受控服務識別的類型。
名稱 |
類型 |
Description |
UserAssigned
|
string
|
|
MySQLServerSku
伺服器帳單相關信息屬性。
名稱 |
類型 |
Description |
name
|
string
|
sku 的名稱,例如Standard_D32s_v3。
|
tier
|
ServerSkuTier
|
特定 SKU 的層,例如 GeneralPurpose。
|
Network
伺服器的網路相關屬性
名稱 |
類型 |
Description |
delegatedSubnetResourceId
|
string
|
用來設定伺服器的 vnet 的委派子網資源標識碼。
|
privateDnsZoneResourceId
|
string
|
私用 DNS 區域資源標識碼。
|
publicNetworkAccess
|
EnableStatusEnum
|
是否允許此伺服器的公用網路存取。 當伺服器具有 VNet 整合時,值為 『Disabled』。
|
PrivateEndpoint
私人端點資源。
名稱 |
類型 |
Description |
id
|
string
|
私人端點的ARM標識碼。
|
PrivateEndpointConnection
私人端點聯機資源。
名稱 |
類型 |
Description |
id
|
string
|
資源的完整資源識別碼。 例如“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}”
|
name
|
string
|
資源的名稱
|
properties.groupIds
|
string[]
|
私人端點資源的群組標識碼。
|
properties.privateEndpoint
|
PrivateEndpoint
|
私人端點資源。
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
服務取用者與提供者之間連線狀態的相關信息集合。
|
properties.provisioningState
|
PrivateEndpointConnectionProvisioningState
|
私人端點聯機資源的布建狀態。
|
systemData
|
systemData
|
Azure Resource Manager 包含 createdBy 和 modifiedBy 資訊的中繼資料。
|
type
|
string
|
資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”
|
PrivateEndpointConnectionProvisioningState
目前的布建狀態。
名稱 |
類型 |
Description |
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Succeeded
|
string
|
|
PrivateEndpointServiceConnectionStatus
私人端點連線狀態。
名稱 |
類型 |
Description |
Approved
|
string
|
|
Pending
|
string
|
|
Rejected
|
string
|
|
PrivateLinkServiceConnectionState
服務取用者與提供者之間連線狀態的相關信息集合。
ReplicationRole
複寫角色。
名稱 |
類型 |
Description |
None
|
string
|
|
Replica
|
string
|
|
Source
|
string
|
|
Server
表示伺服器。
名稱 |
類型 |
Description |
id
|
string
|
資源的完整資源識別碼。 例如“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}”
|
identity.principalId
|
string
|
KeyVault 中的 ObjectId
|
identity.tenantId
|
string
|
KeyVault 中的 TenantId
|
identity.type
|
ManagedServiceIdentityType
|
受控服務識別的類型。
|
identity.userAssignedIdentities
|
object
|
使用者指派身分識別的元數據。
|
location
|
string
|
資源所在的地理位置
|
name
|
string
|
資源的名稱
|
properties.administratorLogin
|
string
|
伺服器的系統管理員登入名稱。 只有在建立伺服器 (且建立) 時才能指定。
|
properties.administratorLoginPassword
|
string
|
伺服器建立) 所需的系統管理員登入密碼 (。
|
properties.availabilityZone
|
string
|
伺服器的可用性區域資訊。
|
properties.backup
|
Backup
|
備份伺服器的相關屬性。
|
properties.createMode
|
CreateMode
|
建立新 MySQL 伺服器的模式。
|
properties.dataEncryption
|
DataEncryption
|
CMK 的數據加密。
|
properties.fullyQualifiedDomainName
|
string
|
伺服器的完整功能變數名稱。
|
properties.highAvailability
|
HighAvailability
|
伺服器的高可用性相關屬性。
|
properties.importSourceProperties
|
ImportSourceProperties
|
從記憶體匯入的來源屬性。
|
properties.maintenanceWindow
|
MaintenanceWindow
|
伺服器的維護期間。
|
properties.network
|
Network
|
伺服器的網路相關屬性。
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
伺服器的 PrivateEndpointConnections 相關屬性。
|
properties.replicaCapacity
|
integer
|
主伺服器可以擁有的最大複本數目。
|
properties.replicationRole
|
ReplicationRole
|
複寫角色。
|
properties.restorePointInTime
|
string
|
還原點建立時間 (ISO8601 格式) ,指定要從中還原的時間。
|
properties.sourceServerResourceId
|
string
|
來源 MySQL 伺服器識別碼。
|
properties.state
|
ServerState
|
伺服器的狀態。
|
properties.storage
|
Storage
|
伺服器的記憶體相關屬性。
|
properties.version
|
ServerVersion
|
伺服器版本。
|
sku
|
MySQLServerSku
|
伺服器的 SKU (定價層) 。
|
systemData
|
systemData
|
Azure Resource Manager 包含 createdBy 和 modifiedBy 資訊的中繼資料。
|
tags
|
object
|
資源標籤。
|
type
|
string
|
資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”
|
ServerForUpdate
允許更新伺服器的參數。
名稱 |
類型 |
Description |
identity.principalId
|
string
|
KeyVault 中的 ObjectId
|
identity.tenantId
|
string
|
KeyVault 中的 TenantId
|
identity.type
|
ManagedServiceIdentityType
|
受控服務識別的類型。
|
identity.userAssignedIdentities
|
object
|
使用者指派身分識別的元數據。
|
properties.administratorLoginPassword
|
string
|
系統管理員登入的密碼。
|
properties.backup
|
Backup
|
備份伺服器的相關屬性。
|
properties.dataEncryption
|
DataEncryption
|
CMK 的數據加密。
|
properties.highAvailability
|
HighAvailability
|
伺服器的高可用性相關屬性。
|
properties.maintenanceWindow
|
MaintenanceWindow
|
伺服器的維護期間。
|
properties.network
|
Network
|
伺服器的網路相關屬性
|
properties.replicationRole
|
ReplicationRole
|
伺服器的復寫角色。
|
properties.storage
|
Storage
|
伺服器的記憶體相關屬性。
|
properties.version
|
ServerVersion
|
伺服器版本。
|
sku
|
MySQLServerSku
|
伺服器的 SKU (定價層) 。
|
tags
|
object
|
索引鍵/值組形式的應用程式特有中繼資料。
|
ServerSkuTier
特定 SKU 的層,例如 GeneralPurpose。
名稱 |
類型 |
Description |
Burstable
|
string
|
|
GeneralPurpose
|
string
|
|
MemoryOptimized
|
string
|
|
ServerState
伺服器的狀態。
名稱 |
類型 |
Description |
Disabled
|
string
|
|
Dropping
|
string
|
|
Ready
|
string
|
|
Starting
|
string
|
|
Stopped
|
string
|
|
Stopping
|
string
|
|
Updating
|
string
|
|
ServerVersion
伺服器的版本。
名稱 |
類型 |
Description |
5.7
|
string
|
|
8.0.21
|
string
|
|
Storage
伺服器的記憶體配置檔屬性
名稱 |
類型 |
預設值 |
Description |
autoGrow
|
EnableStatusEnum
|
Disabled
|
啟用記憶體自動成長。
|
autoIoScaling
|
EnableStatusEnum
|
Enabled
|
啟用 IO 自動調整。
|
iops
|
integer
|
|
伺服器的記憶體 IOPS。
|
logOnDisk
|
EnableStatusEnum
|
Disabled
|
啟用登入磁碟。
|
storageSizeGB
|
integer
|
|
伺服器允許的記憶體大小上限。
|
storageSku
|
string
|
|
伺服器記憶體的 SKU 名稱。
|
systemData
與建立和上次修改資源相關的元數據。
名稱 |
類型 |
Description |
createdAt
|
string
|
資源建立的時間戳 (UTC) 。
|
createdBy
|
string
|
建立資源的身分識別。
|
createdByType
|
createdByType
|
建立資源的身分識別類型。
|
lastModifiedAt
|
string
|
上次修改的資源時間戳 (UTC)
|
lastModifiedBy
|
string
|
上次修改資源的身分識別。
|
lastModifiedByType
|
createdByType
|
上次修改資源的身分識別類型。
|