Select Language:
If you’re working with the Azure.ResourceManager.Sql SDK (version 1.3.0) in C# to automate BACPAC imports, and you want to use managed identities for access, you might run into some confusion. The SDK’s ImportExistingDatabaseDefinition constructor now supports StorageKeyType.ManagedIdentity and AuthenticationType.ManagedIdentity. The instructions suggest that when using managed identities, you should pass the resource ID of the identity in the storageKey and administratorLogin parameters.
However, there’s a tricky part. Despite the new support, the code still forces non-null checks on these parameters. This makes it unclear if the system-assigned managed identity is currently supported or if only user-assigned identities are functional at this stage.
Here’s what you need to know:
First, it’s not entirely clear whether your system-assigned managed identity will work with the current SDK version for the BACPAC import operation. Some users have found that only user-assigned managed identities are supported at the moment. If you’re planning to use a user-assigned identity, you’ll need to set it up in Azure: assign the identity to your SQL server, then grant it the Storage Blob Data Reader role on your storage container. When doing this, pass the resource ID of this identity into the ImportExistingDatabaseDefinition parameters.
Additionally, for the import to work smoothly, you should confirm whether the identity needs to be explicitly added via the Azure Portal. The process involves navigating to your SQL server, then to the Identity section, selecting User-assigned, and adding your managed identity.
Finally, it’s a good idea to look for official documentation or example code that clearly shows how to link a managed identity with the database import. This helps ensure you’re following the correct steps and using the most supported approach.
In summary, if you want to use managed identities for importing a database with the SDK, double-check whether system-assigned identities are supported right now, and consider using a user-assigned identity for a smoother experience. Make sure to assign the identity properly in Azure and pass its resource ID during setup. If you’re unsure, consulting the official Azure docs or reaching out to support can give you the latest guidance.





