MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.2k stars 21.35k forks source link

have no option to connect with azure sql server from visual studio #106879

Closed XiaoYue2-22 closed 1 year ago

XiaoYue2-22 commented 1 year ago

From part <1 - Assign permissions to read the database> in this document, it could connect with azure sql server from visual studio as below: image

but from my portal page, this shows as below which does not have the same option as above page image

Ask: How can I connect azure sql server from portal option? Also I checked in visual studio tool, but can't find way to connect with Azure sql server


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Naveenommi-MSFT commented 1 year ago

@XiaoYue2-22 Thanks for your feedback! We will investigate and update as appropriate.

HeidiSteen commented 1 year ago

@xiaoyue2-22, the indexer connection to Azure SQL is from your search service in the cloud. Search doesn't run locally on your desktop and the search service won't impersonate your identity on the connection to SQL. The connection to Azure SQL needs to be specified in your code, and when you send the indexer request to Search, the service will reach out to Azure SQL.

There are a couple of C# samples that have connection logic you can look at. The samples aren't for Azure SQL, but at least you can see how the connection is set up.

First sample is for Cosmos DB and blob storage: https://github.com/HeidiSteen/azure-search-dotnet-samples/tree/main/multiple-data-sources/v11

Second sample is for ADLS 2 (so also an Azure Storage example): https://github.com/HeidiSteen/azure-search-dotnet-samples/tree/main/data-lake-gen2-acl-indexing

Can you reply back if this unblocks you?? I will take a look at the doc to see if I can improve the content to make the behavior more obvious, but first I'd like to know if the above links answer your question.

XiaoYue2-22 commented 1 year ago

per this document, this part is regarding grant permission to search service to read Azure sql server, if there is no option, how we do this?

HeidiSteen commented 1 year ago

It's in the Prerequisites section. You create a managed identity for your search service. The easiest and fastest way is to do that in the portal. Once you have an identity for Search, you go to Azure SQL and grant the search identity read permissions. Again, the easiest way is in the portal, but if you're used to using PowerShell or CLI, then that could be just as fast.

HeidiSteen commented 1 year ago

I'm closing this issue because I think it's resolved. Please feel free to reopen if you disagree.

please-close