Esporta un database.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export?api-version=2025-01-01
Parametri dell'URI
| Nome |
In |
Necessario |
Tipo |
Descrizione |
|
databaseName
|
path |
True
|
string
|
Nome del database.
|
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Nome del gruppo di risorse. Il nome è insensibile alle maiuscole e minuscole.
|
|
serverName
|
path |
True
|
string
|
Il nome del server.
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
ID della sottoscrizione di destinazione. Il valore deve essere un UUID.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Versione dell'API da usare per questa operazione.
|
Corpo della richiesta
| Nome |
Necessario |
Tipo |
Descrizione |
|
administratorLogin
|
True
|
string
|
Nome di accesso dell'amministratore. Se AuthenticationType è ManagedIdentity, questo campo deve specificare l'ID risorsa dell'identità gestita.
|
|
storageKey
|
True
|
string
|
Chiave di archiviazione per l'account di archiviazione. Se StorageKeyType è ManagedIdentity, questo campo deve specificare l'ID risorsa dell'identità gestita.
|
|
storageKeyType
|
True
|
StorageKeyType
|
Tipo di chiave di archiviazione: StorageAccessKey, SharedAccessKey o ManagedIdentity.
|
|
storageUri
|
True
|
string
|
URI di archiviazione.
|
|
administratorLoginPassword
|
|
string
(password)
|
Password di accesso dell'amministratore. Se AuthenticationType è ManagedIdentity, questo campo non deve essere specificato.
|
|
authenticationType
|
|
string
|
Tipo di credenziali fornite per l'accesso al server SQL di destinazione: SQL, ADPassword o ManagedIdentity.
|
|
networkIsolation
|
|
NetworkIsolationSettings
|
Informazioni facoltative sulle risorse per abilitare l'isolamento di rete per la richiesta.
|
Risposte
| Nome |
Tipo |
Descrizione |
|
200 OK
|
ImportExportOperationResult
|
Operazione Azure completata con successo.
|
|
202 Accepted
|
|
Operazione sulle risorse accettata.
Intestazioni
- Location: string
- Retry-After: integer
|
|
Other Status Codes
|
ErrorResponse
|
Risposta di errore imprevista.
|
Sicurezza
azure_auth
Azure Active Directory OAuth2 Flow.
Tipo:
oauth2
Flow:
implicit
URL di autorizzazione:
https://login.microsoftonline.com/common/oauth2/authorize
Ambiti
| Nome |
Descrizione |
|
user_impersonation
|
rappresentare l'account utente
|
Esempio
Exports a database, using Managed Identity to communicate with SQL server and storage account.
Esempio di richiesta
POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/export?api-version=2025-01-01
{
"administratorLogin": "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
"authenticationType": "ManagedIdentity",
"storageKey": "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
"storageKeyType": "ManagedIdentity",
"storageUri": "https://test.blob.core.windows.net/test.bacpac"
}
import com.azure.resourcemanager.sql.models.ExportDatabaseDefinition;
import com.azure.resourcemanager.sql.models.StorageKeyType;
/**
* Samples for Databases Export.
*/
public final class Main {
/*
* x-ms-original-file: 2025-01-01/ExportDatabaseWithManagedIdentity.json
*/
/**
* Sample code: Exports a database, using Managed Identity to communicate with SQL server and storage account.
*
* @param manager Entry point to SqlServerManager.
*/
public static void exportsADatabaseUsingManagedIdentityToCommunicateWithSQLServerAndStorageAccount(
com.azure.resourcemanager.sql.SqlServerManager manager) {
manager.serviceClient().getDatabases().export("Default-SQL-SouthEastAsia", "testsvr", "testdb",
new ExportDatabaseDefinition().withStorageKeyType(StorageKeyType.MANAGED_IDENTITY)
.withStorageKey("fakeTokenPlaceholder").withStorageUri("https://test.blob.core.windows.net/test.bacpac")
.withAdministratorLogin(
"/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName")
.withAuthenticationType("ManagedIdentity"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python export_database_with_managed_identity.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 = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.databases.begin_export(
resource_group_name="Default-SQL-SouthEastAsia",
server_name="testsvr",
database_name="testdb",
parameters={
"administratorLogin": "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
"authenticationType": "ManagedIdentity",
"storageKey": "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
"storageKeyType": "ManagedIdentity",
"storageUri": "https://test.blob.core.windows.net/test.bacpac",
},
).result()
print(response)
# x-ms-original-file: 2025-01-01/ExportDatabaseWithManagedIdentity.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
const { SqlManagementClient } = require("@azure/arm-sql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to exports a database.
*
* @summary exports a database.
* x-ms-original-file: 2025-01-01/ExportDatabaseWithManagedIdentity.json
*/
async function exportsADatabaseUsingManagedIdentityToCommunicateWithSQLServerAndStorageAccount() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const client = new SqlManagementClient(credential, subscriptionId);
const result = await client.databases.export("Default-SQL-SouthEastAsia", "testsvr", "testdb", {
administratorLogin:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
authenticationType: "ManagedIdentity",
storageKey:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName",
storageKeyType: "ManagedIdentity",
storageUri: "https://test.blob.core.windows.net/test.bacpac",
});
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Sql.Models;
using Azure.ResourceManager.Sql;
// Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/SQL/stable/2025-01-01/examples/ExportDatabaseWithManagedIdentity.json
// this example is just showing the usage of "Databases_Export" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SqlDatabaseResource created on azure
// for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "Default-SQL-SouthEastAsia";
string serverName = "testsvr";
string databaseName = "testdb";
ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName);
SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId);
// invoke the operation
DatabaseExportDefinition databaseExportDefinition = new DatabaseExportDefinition(StorageKeyType.ManagedIdentity, "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", new Uri("https://test.blob.core.windows.net/test.bacpac"), "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName")
{
AuthenticationType = "ManagedIdentity",
};
ArmOperation<ImportExportOperationResult> lro = await sqlDatabase.ExportAsync(WaitUntil.Completed, databaseExportDefinition);
ImportExportOperationResult result = lro.Value;
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
{
"name": "9d9a794a-5cec-4f23-af70-d29511b522a4",
"type": "Microsoft.Sql/servers/databases/importExportOperationResults",
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/importExportOperationResults/9d9a794a-5cec-4f23-af70-d29511b522a4",
"properties": {
"blobUri": "https://test.blob.core.windows.net/test.bacpac",
"databaseName": "testdb",
"lastModifiedTime": "2/2/2020 8:34:47 PM",
"queuedTime": "2/2/2020 8:33:27 PM",
"requestId": "9d9a794a-5cec-4f23-af70-d29511b522a4",
"requestType": "Export",
"serverName": "testsvr.database.windows.net",
"status": "Completed"
}
}
Location: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Sql/locations/japaneast/importExportOperationResults/00000000-0000-0000-0000-000000000000
Exports a database, using private link to communicate with SQL server and storage account.
Esempio di richiesta
POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/export?api-version=2025-01-01
{
"administratorLogin": "login",
"administratorLoginPassword": "password",
"authenticationType": "Sql",
"networkIsolation": {
"sqlServerResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr",
"storageAccountResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink"
},
"storageKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==",
"storageKeyType": "StorageAccessKey",
"storageUri": "https://test.blob.core.windows.net/test.bacpac"
}
import com.azure.resourcemanager.sql.models.ExportDatabaseDefinition;
import com.azure.resourcemanager.sql.models.NetworkIsolationSettings;
import com.azure.resourcemanager.sql.models.StorageKeyType;
/**
* Samples for Databases Export.
*/
public final class Main {
/*
* x-ms-original-file: 2025-01-01/ExportDatabaseWithNetworkIsolation.json
*/
/**
* Sample code: Exports a database, using private link to communicate with SQL server and storage account.
*
* @param manager Entry point to SqlServerManager.
*/
public static void exportsADatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount(
com.azure.resourcemanager.sql.SqlServerManager manager) {
manager.serviceClient().getDatabases().export("Default-SQL-SouthEastAsia", "testsvr", "testdb",
new ExportDatabaseDefinition().withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY)
.withStorageKey("fakeTokenPlaceholder").withStorageUri("https://test.blob.core.windows.net/test.bacpac")
.withAdministratorLogin("login").withAdministratorLoginPassword("fakeTokenPlaceholder")
.withAuthenticationType("Sql")
.withNetworkIsolation(new NetworkIsolationSettings().withStorageAccountResourceId(
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink")
.withSqlServerResourceId(
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python export_database_with_network_isolation.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 = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.databases.begin_export(
resource_group_name="Default-SQL-SouthEastAsia",
server_name="testsvr",
database_name="testdb",
parameters={
"administratorLogin": "login",
"administratorLoginPassword": "password",
"authenticationType": "Sql",
"networkIsolation": {
"sqlServerResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr",
"storageAccountResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink",
},
"storageKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==",
"storageKeyType": "StorageAccessKey",
"storageUri": "https://test.blob.core.windows.net/test.bacpac",
},
).result()
print(response)
# x-ms-original-file: 2025-01-01/ExportDatabaseWithNetworkIsolation.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
const { SqlManagementClient } = require("@azure/arm-sql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to exports a database.
*
* @summary exports a database.
* x-ms-original-file: 2025-01-01/ExportDatabaseWithNetworkIsolation.json
*/
async function exportsADatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const client = new SqlManagementClient(credential, subscriptionId);
const result = await client.databases.export("Default-SQL-SouthEastAsia", "testsvr", "testdb", {
administratorLogin: "login",
administratorLoginPassword: "password",
authenticationType: "Sql",
networkIsolation: {
sqlServerResourceId:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr",
storageAccountResourceId:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink",
},
storageKey:
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==",
storageKeyType: "StorageAccessKey",
storageUri: "https://test.blob.core.windows.net/test.bacpac",
});
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Sql.Models;
using Azure.ResourceManager.Sql;
// Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/SQL/stable/2025-01-01/examples/ExportDatabaseWithNetworkIsolation.json
// this example is just showing the usage of "Databases_Export" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SqlDatabaseResource created on azure
// for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "Default-SQL-SouthEastAsia";
string serverName = "testsvr";
string databaseName = "testdb";
ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName);
SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId);
// invoke the operation
DatabaseExportDefinition databaseExportDefinition = new DatabaseExportDefinition(StorageKeyType.StorageAccessKey, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==", new Uri("https://test.blob.core.windows.net/test.bacpac"), "login")
{
AdministratorLoginPassword = "password",
AuthenticationType = "Sql",
NetworkIsolation = new NetworkIsolationSettings
{
StorageAccountResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink"),
SqlServerResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr"),
},
};
ArmOperation<ImportExportOperationResult> lro = await sqlDatabase.ExportAsync(WaitUntil.Completed, databaseExportDefinition);
ImportExportOperationResult result = lro.Value;
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
{
"name": "9d9a794a-5cec-4f23-af70-d29511b522a4",
"type": "Microsoft.Sql/servers/databases/importExportOperationResults",
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/importExportOperationResults/9d9a794a-5cec-4f23-af70-d29511b522a4",
"properties": {
"blobUri": "https://test.blob.core.windows.net/test.bacpac",
"databaseName": "testdb",
"lastModifiedTime": "2/2/2020 8:34:47 PM",
"queuedTime": "2/2/2020 8:33:27 PM",
"requestId": "9d9a794a-5cec-4f23-af70-d29511b522a4",
"requestType": "Export",
"serverName": "testsvr.database.windows.net",
"status": "Completed"
}
}
Location: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Sql/locations/japaneast/importExportOperationResults/00000000-0000-0000-0000-000000000000
Exports a database.
Esempio di richiesta
POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/export?api-version=2025-01-01
{
"administratorLogin": "login",
"administratorLoginPassword": "password",
"authenticationType": "Sql",
"storageKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==",
"storageKeyType": "StorageAccessKey",
"storageUri": "https://test.blob.core.windows.net/test.bacpac"
}
import com.azure.resourcemanager.sql.models.ExportDatabaseDefinition;
import com.azure.resourcemanager.sql.models.StorageKeyType;
/**
* Samples for Databases Export.
*/
public final class Main {
/*
* x-ms-original-file: 2025-01-01/ExportDatabase.json
*/
/**
* Sample code: Exports a database.
*
* @param manager Entry point to SqlServerManager.
*/
public static void exportsADatabase(com.azure.resourcemanager.sql.SqlServerManager manager) {
manager.serviceClient().getDatabases().export("Default-SQL-SouthEastAsia", "testsvr", "testdb",
new ExportDatabaseDefinition().withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY)
.withStorageKey("fakeTokenPlaceholder").withStorageUri("https://test.blob.core.windows.net/test.bacpac")
.withAdministratorLogin("login").withAdministratorLoginPassword("fakeTokenPlaceholder")
.withAuthenticationType("Sql"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python export_database.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 = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.databases.begin_export(
resource_group_name="Default-SQL-SouthEastAsia",
server_name="testsvr",
database_name="testdb",
parameters={
"administratorLogin": "login",
"administratorLoginPassword": "password",
"authenticationType": "Sql",
"storageKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==",
"storageKeyType": "StorageAccessKey",
"storageUri": "https://test.blob.core.windows.net/test.bacpac",
},
).result()
print(response)
# x-ms-original-file: 2025-01-01/ExportDatabase.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
const { SqlManagementClient } = require("@azure/arm-sql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to exports a database.
*
* @summary exports a database.
* x-ms-original-file: 2025-01-01/ExportDatabase.json
*/
async function exportsADatabase() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const client = new SqlManagementClient(credential, subscriptionId);
const result = await client.databases.export("Default-SQL-SouthEastAsia", "testsvr", "testdb", {
administratorLogin: "login",
administratorLoginPassword: "password",
authenticationType: "Sql",
storageKey:
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==",
storageKeyType: "StorageAccessKey",
storageUri: "https://test.blob.core.windows.net/test.bacpac",
});
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Sql.Models;
using Azure.ResourceManager.Sql;
// Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/SQL/stable/2025-01-01/examples/ExportDatabase.json
// this example is just showing the usage of "Databases_Export" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SqlDatabaseResource created on azure
// for more information of creating SqlDatabaseResource, please refer to the document of SqlDatabaseResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "Default-SQL-SouthEastAsia";
string serverName = "testsvr";
string databaseName = "testdb";
ResourceIdentifier sqlDatabaseResourceId = SqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName);
SqlDatabaseResource sqlDatabase = client.GetSqlDatabaseResource(sqlDatabaseResourceId);
// invoke the operation
DatabaseExportDefinition databaseExportDefinition = new DatabaseExportDefinition(StorageKeyType.StorageAccessKey, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==", new Uri("https://test.blob.core.windows.net/test.bacpac"), "login")
{
AdministratorLoginPassword = "password",
AuthenticationType = "Sql",
};
ArmOperation<ImportExportOperationResult> lro = await sqlDatabase.ExportAsync(WaitUntil.Completed, databaseExportDefinition);
ImportExportOperationResult result = lro.Value;
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
{
"name": "9d9a794a-5cec-4f23-af70-d29511b522a4",
"type": "Microsoft.Sql/servers/databases/importExportOperationResults",
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/importExportOperationResults/9d9a794a-5cec-4f23-af70-d29511b522a4",
"properties": {
"blobUri": "https://test.blob.core.windows.net/test.bacpac",
"databaseName": "testdb",
"lastModifiedTime": "2/2/2020 8:34:47 PM",
"queuedTime": "2/2/2020 8:33:27 PM",
"requestId": "9d9a794a-5cec-4f23-af70-d29511b522a4",
"requestType": "Export",
"serverName": "testsvr.database.windows.net",
"status": "Completed"
}
}
Location: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Sql/locations/japaneast/importExportOperationResults/00000000-0000-0000-0000-000000000000
Definizioni
createdByType
Enumerazione
Tipo di identità che ha creato la risorsa.
| Valore |
Descrizione |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
ErrorAdditionalInfo
Oggetto
Informazioni aggiuntive sull'errore di gestione delle risorse.
| Nome |
Tipo |
Descrizione |
|
info
|
object
|
Informazioni aggiuntive.
|
|
type
|
string
|
Tipo di informazioni aggiuntive.
|
ErrorDetail
Oggetto
Dettagli dell'errore.
| Nome |
Tipo |
Descrizione |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Informazioni aggiuntive sull'errore.
|
|
code
|
string
|
Codice di errore.
|
|
details
|
ErrorDetail[]
|
Dettagli dell'errore.
|
|
message
|
string
|
Messaggio di errore.
|
|
target
|
string
|
Destinazione dell'errore.
|
ErrorResponse
Oggetto
Risposta di errore
ExportDatabaseDefinition
Oggetto
Contiene le informazioni necessarie per eseguire l'operazione di esportazione del database.
| Nome |
Tipo |
Descrizione |
|
administratorLogin
|
string
|
Nome di accesso dell'amministratore. Se AuthenticationType è ManagedIdentity, questo campo deve specificare l'ID risorsa dell'identità gestita.
|
|
administratorLoginPassword
|
string
(password)
|
Password di accesso dell'amministratore. Se AuthenticationType è ManagedIdentity, questo campo non deve essere specificato.
|
|
authenticationType
|
string
|
Tipo di credenziali fornite per l'accesso al server SQL di destinazione: SQL, ADPassword o ManagedIdentity.
|
|
networkIsolation
|
NetworkIsolationSettings
|
Informazioni facoltative sulle risorse per abilitare l'isolamento di rete per la richiesta.
|
|
storageKey
|
string
|
Chiave di archiviazione per l'account di archiviazione. Se StorageKeyType è ManagedIdentity, questo campo deve specificare l'ID risorsa dell'identità gestita.
|
|
storageKeyType
|
StorageKeyType
|
Tipo di chiave di archiviazione: StorageAccessKey, SharedAccessKey o ManagedIdentity.
|
|
storageUri
|
string
|
URI di archiviazione.
|
ImportExportOperationResult
Oggetto
Risorsa risultato dell'operazione ImportExport.
| Nome |
Tipo |
Descrizione |
|
id
|
string
(arm-id)
|
ID risorsa completo per la risorsa. Ad esempio, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
name
|
string
|
Nome della risorsa
|
|
properties.blobUri
|
string
|
URI BLOB.
|
|
properties.databaseName
|
string
|
nome del database.
|
|
properties.errorMessage
|
string
|
Messaggio di errore.
|
|
properties.lastModifiedTime
|
string
|
Ora dell'ultima modifica.
|
|
properties.privateEndpointConnections
|
PrivateEndpointConnectionRequestStatus[]
|
Ottiene lo stato degli endpoint privati associati a questa richiesta.
|
|
properties.queuedTime
|
string
|
Tempo in coda.
|
|
properties.requestId
|
string
(uuid)
|
ID richiesta.
|
|
properties.requestType
|
string
|
Tipo di richiesta.
|
|
properties.serverName
|
string
|
Nome server.
|
|
properties.status
|
string
|
Stato dell'operazione.
|
|
systemData
|
systemData
|
Azure Resource Manager metadati contenenti informazioni createBy e modifiedBy.
|
|
type
|
string
|
Tipo di risorsa. Ad esempio: "Microsoft. Compute/virtualMachines" oppure "Microsoft. Storage/storageAccounts"
|
NetworkIsolationSettings
Oggetto
Contiene le risorse arm per le quali creare una connessione all'endpoint privato.
| Nome |
Tipo |
Descrizione |
|
sqlServerResourceId
|
string
(arm-id)
|
ID risorsa per SQL Server che è la destinazione di questa richiesta. Se impostato, verrà creata la connessione all'endpoint privato per SQL Server. Deve corrispondere al server di destinazione dell'operazione.
|
|
storageAccountResourceId
|
string
(arm-id)
|
ID risorsa per l'account di archiviazione usato per archiviare il file BACPAC. Se impostato, verrà creata la connessione all'endpoint privato per l'account di archiviazione. Deve corrispondere all'account di archiviazione usato per il parametro StorageUri.
|
PrivateEndpointConnectionRequestStatus
Oggetto
Contiene lo stato delle richieste di connessione dell'endpoint privato.
| Nome |
Tipo |
Descrizione |
|
privateEndpointConnectionName
|
string
|
Nome della connessione per l'endpoint privato.
|
|
privateLinkServiceId
|
string
|
ID risorsa per cui viene creato l'endpoint privato.
|
|
status
|
string
|
Stato di questa connessione endpoint privato.
|
StorageKeyType
Enumerazione
Tipo di chiave di archiviazione: StorageAccessKey, SharedAccessKey o ManagedIdentity.
| Valore |
Descrizione |
|
SharedAccessKey
|
SharedAccessKey
|
|
StorageAccessKey
|
StorageAccessKey
|
|
ManagedIdentity
|
ManagedIdentity
|
systemData
Oggetto
Metadati relativi alla creazione e all'ultima modifica della risorsa.
| Nome |
Tipo |
Descrizione |
|
createdAt
|
string
(date-time)
|
Timestamp della creazione della risorsa (UTC).
|
|
createdBy
|
string
|
Identità che ha creato la risorsa.
|
|
createdByType
|
createdByType
|
Tipo di identità che ha creato la risorsa.
|
|
lastModifiedAt
|
string
(date-time)
|
Il timestamp dell'ultima modifica della risorsa (UTC)
|
|
lastModifiedBy
|
string
|
Identità che ha modificato l'ultima volta la risorsa.
|
|
lastModifiedByType
|
createdByType
|
Tipo di identità che ha modificato l'ultima volta la risorsa.
|