Is it possible to implement user based security on Azure Search? Is it possible to implement user based security on Azure Search? azure azure

Is it possible to implement user based security on Azure Search?


Out of the box it is not possible to restrict the key usage for a specific index. You would need to do something on your own.

Other possibility would be to create different search service accounts and then creating indexes in them instead of having one account. You can then grant access to your users to appropriate search service account.

UPDATE

Based on your comments, you're actually looking to restrict search results (documents) by user's role i.e. going one level deeper than indexes. To achieve this, what you could do is dynamically append this role criteria to your search query as OData Filter. For example, let's say your index has boolean fields for each role type (Administrator, User etc. etc.) and the user searches for some keyword. Then what you could do is create an OData Filter $filter where you check for these conditions. So your search URL would look something like:

https://<search-service-name>.search.windows.net/indexes/<index-name>/docs?search=<search-string>&$filter=Administrator%20eq%20true

That way Search Service is doing all the filtering and you don't have to do anything in your code.

You can learn more about query options here: https://msdn.microsoft.com/en-us/library/azure/dn798927.aspx.