Skip to content

Commit 79e1bb1

Browse files
authored
docs: introduce connect to Azure SQL Managed Instance using system-assigned managed identity in VM (#550)
* docs: introduce connect to Azure SQL Managed Instance using system-assigned managed identity in VM Signed-off-by: h3n4l <oysterdays@gmail.com> * fix: typo Signed-off-by: h3n4l <oysterdays@gmail.com> --------- Signed-off-by: h3n4l <oysterdays@gmail.com>
1 parent f45f780 commit 79e1bb1

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

content/docs/get-started/instance.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,52 @@ While creating an RDS or Aurora instance, you can choose to enable IAM authentic
211211
1. Go to SQL overview page, you'll find the **Connection name**, use it as the host. Choose `Google Cloud SQL IAM` along with your user `bytebase` to connect to the database.
212212
![](/content/docs/get-started/instance/gcp-iam/connection-name.webp)
213213
214+
### Azure SQL
215+
216+
Bytebase supports connect to Azure SQL through Azure IAM by using default Azure credential and client secret credential. This section introduces how to use [system-assigned managed identity](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview#managed-identity-types) to connect to Azure SQL.
217+
For more information about the credential chain in default Azure credential, please refer to [default azure credential overview](https://learn.microsoft.com/en-us/azure/developer/go/sdk/authentication/credential-chains#how-a-chained-credential-works).
218+
219+
#### Create a VM with enabled system-assigned managed identity
220+
221+
1. Enable system assigned managed identity while creating a VM.
222+
![](/content/docs/get-started/instance/azure-iam/enable-system-assigned-managed-identity-while-creating-vm.webp)
223+
224+
2. Deploy the Bytebase on the VM in Docker:
225+
226+
```bash
227+
docker run --init \
228+
--network=host \
229+
--name bytebase \
230+
--pull always \
231+
--volume ~/.bytebase/data:/var/opt/bytebase \
232+
bytebase/bytebase:%%bb_version%%
233+
```
234+
235+
#### Enable Microsoft Entra Authentication in Azure SQL
236+
237+
1. Go to the Azure SQL panel, and set the Microsoft Entra Admin for Azure SQL managed instance, don't forget to click Save button. Once you set the Microsoft Entra Admin, the Microsoft Entra authentication is enabled. Check the [Microsoft guide](https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/configure-azure-ad-authentication-for-sql-vm?view=azuresql&tabs=azure-portal) if you use Azure SQL on VM.
238+
239+
![](/content/docs/get-started/instance/azure-iam/set-microsoft-entra-admin-in-azure-sql-panel.webp)
240+
241+
#### Create a contained database user
242+
243+
1. Connect to the Azure SQL database using the Microsoft Entra Admin account.
244+
245+
2. For each databases desired to be managed by Bytebase, running the following SQL command inside the database to a contained database user:
246+
247+
```sql
248+
CREATE USER [<Microsoft_Entra_principal_name>] FROM EXTERNAL PROVIDER;
249+
ALTER ROLE db_owner ADD MEMBER [<Microsoft_Entra_principal_name>];
250+
```
251+
252+
#### Connect to Azure SQL Database in Bytebase
253+
254+
1. Using Azure IAM default credential to connect to Azure SQL database:
255+
256+
![](/content/docs/get-started/instance/azure-iam/connect-to-azure-sql-using-azure-iam-frontend-form.webp)
257+
258+
In this way, Bytebase can only connect to one specific Azure SQL database. To managed multiple Azure SQL databases in one instance inside Bytebase, considering set the VM principal as the Azure SQL Managed Instance Microsoft Entra Admin.
259+
214260
## Use external secret manager
215261
216262
<PricingPlanBlock feature_name='EXTERNAL_SECRET_MANAGER' />
101 KB
Loading
104 KB
Loading
108 KB
Loading

0 commit comments

Comments
 (0)