Skip to content

Commit 128d7aa

Browse files
Public preview of migration of users/roles
1 parent 073b655 commit 128d7aa

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

articles/postgresql/migrate/concepts-single-to-flexible.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,35 @@ The following table shows the time for performing offline migrations for databas
101101
> [!IMPORTANT]
102102
> In order to perform faster migrations, pick a higher SKU for your flexible server. You can always change the SKU to match the application needs post migration.
103103
104+
## Migration of users/roles, ownerships and privileges
105+
Along with data migration, the tool automatically provides the following built-in capabilities:
106+
- Migration of users/roles present on your source server to the target server.
107+
- Migration of ownership of all the database objects on your source server to the target server.
108+
- Migration of permissions of database objects on your source server such as GRANTS/REVOKES to the target server.
109+
110+
> [!NOTE]
111+
> This functionality is enabled only for flexible servers in **North Europe** region. It will be enabled for flexible servers in other Azure regions soon. In the meantime, you can follow the steps mentioned in this [doc](../single-server/how-to-upgrade-using-dump-and-restore#migrate-the-roles) to perform user/roles migration
112+
104113
## Limitations
105114

106115
- You can have only one active migration to your flexible server.
107116
- You can select a max of eight databases in one migration attempt. If you've more than eight databases, you must wait for the first migration to be complete before initiating another migration for the rest of the databases. Support for migration of more than eight databases in a single migration will be introduced later.
108117
- The source and target server must be in the same Azure region. Cross region migrations are not supported.
109-
- The tool takes care of the migration of data and schema. It doesn't migrate managed service features such as server parameters, connection security details, firewall rules, users, roles and permissions. In the later part of the document, we point you to docs that can help you perform the migration of users, roles and firewall rules from single server to flexible server.
118+
- The tool takes care of the migration of data and schema. It doesn't migrate managed service features such as server parameters, connection security details and firewall rules.
110119
- The migration tool shows the number of tables copied from source to target server. You need to validate the data in target server post migration.
111120
- The tool only migrates user databases and not system databases like template_0, template_1, azure_sys and azure_maintenance.
112121

122+
> [!NOTE]
123+
> The following limitations are applicable only for flexible servers on which the migration of users/roles functionality is enabled.
124+
125+
- AAD users present on your source server will not be migrated to target server. To mitigate this limitation, manually create all AAD users on your target server using this [link](../flexible-server/how-to-manage-azure-ad-users.md) before triggering a migration. If AAD users are not created on target server, migration will fail with appropriate error message.
126+
- If the target flexible server uses SCRAM-SHA-256 password encrpytion method, connection to flexible server using the users/roles on single server will fail since the passwords are encrypted using md5 algorithm. To mitigate this limitation, please choose the option **MD5** for **password_encryption** server parameter on your flexible server.
127+
- Though the ownership of database objects such as tables, views, sequences, etc. are copied to the target server, the owner of the database in your target server will be the migration user of your target server. The limitation can be mitigated by executing the following command
128+
129+
```sql
130+
ALTER DATABASE <dbname> OWNER TO <user>;
131+
```
132+
Make sure the user executing the above command is a member of the user to which ownership is being assigned to. This limitation will be fixed in the upcoming releases of the migration tool to match the database owners on your source server.
113133
## Experience
114134

115135
Get started with the Single to Flex migration tool by using any of the following methods:
@@ -151,7 +171,7 @@ For calculating the total downtime to perform offline migration of production se
151171
> [!NOTE]
152172
> The size of databases is not the right metric for validation.The source server might have bloats/dead tuples which can bump up the size on the source server. Also, the storage containers used in single and flexible servers are completely different. It is completely normal to have size differences between source and target servers. If there is an issue in the first three steps of validation, it indicates a problem with the migration.
153173
154-
- **Migration of server settings** - The users, roles/privileges, server parameters, firewall rules (if applicable), tags, alerts need to be manually copied from single server to flexible server. Users and roles are migrated from Single to Flexible server by following the steps listed in this [doc](../single-server/how-to-upgrade-using-dump-and-restore.md).
174+
- **Migration of server settings** - The server parameters, firewall rules (if applicable), tags, alerts need to be manually copied from single server to flexible server.
155175

156176
- **Changing connection strings** - Post successful validation, application should change their connection strings to point to flexible server. This activity is coordinated with the application team to make changes to all the references of connection strings pointing to single server. Note that in the flexible server the user parameter in the connection string no longer needs to be in the **username@servername** format. You should just use the **user=username** format for this parameter in the connection string
157177
For example
@@ -229,6 +249,25 @@ The changes to this server parameter would require a server restart to come into
229249

230250
Use the **Save and Restart** option and wait for the postgresql server to restart.
231251

252+
> [!NOTE]
253+
> The following pre-requisite is applicable only for flexible servers on which the migration of users/roles functionality is enabled.
254+
##### Create AAD users on target server
255+
Execute the following query on your source server to get the list of AAD users.
256+
```sql
257+
SELECT r.rolname
258+
FROM
259+
pg_roles r
260+
JOIN pg_auth_members am ON r.oid = am.member
261+
JOIN pg_roles m ON am.roleid = m.oid
262+
WHERE
263+
m.rolname IN (
264+
'azure_ad_admin',
265+
'azure_ad_user',
266+
'azure_ad_mfa'
267+
);
268+
```
269+
Create the AAD users on your target flexible server using this [link](../flexible-server/how-to-manage-azure-ad-users.md) before creating a migration.
270+
232271
### Migration
233272

234273
Once the pre-migration steps are complete, you're ready to carry out the migration of the production databases of your single server. At this point, you've finalized the day and time of production migration along with a planned downtime for your applications.
@@ -264,7 +303,6 @@ If the above conditions are met, the table will be migrated in multiple partitio
264303
- Once the migration is complete, verify the data on your flexible server and make sure it's an exact copy of the single server.
265304
- Post verification, enable HA option as needed on your flexible server.
266305
- Change the SKU of the flexible server to match the application needs. This change needs a database server restart.
267-
- Migrate users and roles from single to flexible servers. This step can be done by creating users on flexible servers and providing them with suitable privileges or by using the steps that are listed in this [doc](../single-server/how-to-upgrade-using-dump-and-restore.md).
268306
- If you've changed any server parameters from their default values in single server, copy those server parameter values in flexible server.
269307
- Copy other server settings like tags, alerts, firewall rules (if applicable) from single server to flexible server.
270308
- Make changes to your application to point the connection strings to flexible server.

0 commit comments

Comments
 (0)