Skip to content

Commit 7d37d0d

Browse files
matthetheringtonisra-felCopilot
authored
Document using managed identity with New-AzSqlDatabaseExport (#27881)
Co-authored-by: Yeming Liu <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 4b28e88 commit 7d37d0d

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

src/Sql/Sql/help/New-AzSqlDatabaseExport.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The get export database status request may be sent to retrieve status informatio
2828
This cmdlet is also supported by the SQL Server Stretch Database service on Azure.
2929

3030
> [!IMPORTANT]
31-
> In order to make use of this cmdlet the firewall on the Azure SQL Server will need to be configured to "Allow Azure services and resources to access this server". If this is not configured then GatewayTimeout errors will be experienced.
31+
> In order to make use of this cmdlet the firewall on the Azure SQL Server will need to be configured to "Allow Azure services and resources to access this server". If this is not configured then GatewayTimeout errors will be experienced. This is not required if a Private Link connection is established via the UseNetworkIsolation parameter.
3232
3333
## EXAMPLES
3434

@@ -55,11 +55,39 @@ ErrorMessage :
5555

5656
This command creates an export request for the specified database.
5757

58+
### Example 2: Create an export request for a database using managed identity for authentication over private link
59+
60+
```powershell
61+
$sqlServerName = "Server01"
62+
$storageAccountName = "storageaccount1"
63+
$subscriptionId = "00000000-0000-0000-0000-000000000000"
64+
$resourceGroup = "RG01"
65+
$managedIdentityResourceId = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/my-managed-identity"
66+
$pw = ConvertTo-SecureString "******" -AsPlainText -Force
67+
New-AzSqlDatabaseExport `
68+
-ResourceGroupName $resourceGroup `
69+
-ServerName $sqlServerName `
70+
-DatabaseName "Database01" `
71+
-StorageKeyType ManagedIdentity `
72+
-StorageKey $managedIdentityResourceId `
73+
-StorageUri "https://storageaccount1.blob.core.windows.net/container1/my-file-name.bacpac" `
74+
-AuthenticationType ManagedIdentity `
75+
-AdministratorLogin $managedIdentityResourceId `
76+
-AdministratorLoginPassword $pw `
77+
-UseNetworkIsolation $true `
78+
-SqlServerResourceIdForPrivateLink "/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/providers/Microsoft.Sql/servers/$sqlServerName" `
79+
-StorageAccountResourceIdForPrivateLink "/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/providers/Microsoft.Storage/storageAccounts/$storageAccountName"
80+
```
81+
82+
This command creates an export request for the specified database using managed identity for authentication with connectivity over Private Link.
83+
5884
## PARAMETERS
5985

6086
### -AdministratorLogin
6187
Specifies the name of the SQL administrator.
6288

89+
If `-AuthenticationType ManagedIdentity` is provided, this should be the full resource ID of a user-assigned managed identity that is a [Microsoft Entra administrator](https://learn.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-configure?view=azuresql&tabs=azure-portal#set-microsoft-entra-admin) of the server.
90+
6391
```yaml
6492
Type: System.String
6593
Parameter Sets: (All)
@@ -75,6 +103,7 @@ Accept wildcard characters: False
75103
### -AdministratorLoginPassword
76104
Specifies the password of the SQL administrator.
77105
106+
This is mandatory. When using `-AuthenticationType ManagedIdentity`, a placeholder value (for example, any non-empty SecureString value) must be provided.
78107
```yaml
79108
Type: System.Security.SecureString
80109
Parameter Sets: (All)
@@ -98,6 +127,9 @@ Set the *AdministratorLogin* and *AdministratorLoginPassword* to the SQL adminis
98127
Microsoft Entra authentication.
99128
Set *AdministratorLogin* and *AdministratorLoginPassword* to the Microsoft Entra administrator username and password.
100129
This parameter is only available on SQL Database V12 servers.
130+
- ManagedIdentity.
131+
Managed identity authentication.
132+
Use a user-assigned managed identity to authenticate with the SQL server. The managed identity must be a [Microsoft Entra administrator](https://learn.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-configure?view=azuresql&tabs=azure-portal#set-microsoft-entra-admin) for the server.
101133

102134
```yaml
103135
Type: Microsoft.Azure.Commands.Sql.ImportExport.Model.AuthenticationType
@@ -205,6 +237,8 @@ Accept wildcard characters: False
205237
### -StorageKey
206238
Specifies the access key for the storage account.
207239

240+
When `-StorageKeyType ManagedIdentity` is provided, this should be the full resource ID of a user-assigned managed identity which has write access on the storage account for the StorageUri provided (for example via a [Storage Blob Data Contributor](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles/storage#storage-blob-data-contributor) role assignment).
241+
208242
```yaml
209243
Type: System.String
210244
Parameter Sets: (All)
@@ -224,6 +258,8 @@ The acceptable values for this parameter are:
224258
This value uses a storage account key.
225259
- SharedAccessKey.
226260
This value uses a Shared Access Signature (SAS) key.
261+
- ManagedIdentity.
262+
Use a user-assigned managed identity for authentication with the storage account.
227263

228264
```yaml
229265
Type: Microsoft.Azure.Commands.Sql.ImportExport.Model.StorageKeyType
@@ -239,8 +275,7 @@ Accept wildcard characters: False
239275
```
240276

241277
### -StorageUri
242-
Specifies the blob link, as a URL, to the .bacpac file.
243-
278+
Specifies the blob link, as a URL, to the .bacpac file. For example: `-StorageUri "https://your-storage-account.blob.core.windows.net/your-container/your-file-name.bacpac"`
244279
```yaml
245280
Type: System.Uri
246281
Parameter Sets: (All)

0 commit comments

Comments
 (0)