I am trying to index some data to search service and retrieve it using search queries which is in Government cloud. The search service Url ends with (.search.azure.us). This is different from normal azure search service where URL ends up with (.search.windows.net).
Our team uses Azure .Net SDK version 5 and I see that when I create SearchIndexClient with a service name the constructor validates the service url and always appends .search.windows.net at the end of it and will fail for gcc urls like *.search.azure.us.
I Was looking into the Azure search client library and SearchIndexClient always validates with .search.wndows.net suffix
private static void ValidateSearchServiceAndIndexNames(string searchServiceName, string indexName)
{
Throw.IfNullOrEmptySearchServiceName(searchServiceName);
SearchIndexClient.ThrowIfNullOrEmptyIndexName(indexName, nameof (indexName));
if (TypeConversion.TryParseUri(string.Format("https://{0}.search.windows.net/indexes('{1}')/",
(object) searchServiceName, (object) indexName)) == (Uri) null)
throw new ArgumentException(string.Format("Either the search service name '{0}' or the index name
'{1}' is invalid. Names must contain only characters that are valid in a URL.", (object)
searchServiceName, (object) indexName), nameof (searchServiceName));
}
So is there any upgraded version of sdk available where search index client could support URLs like ".search.azure.us"? or any other recommended way for government cloud urls?
Is it as simple as setting SearchDnsSuffix Property correctly on searchIndexClient to the appropriate suffix?
Could you share how you are instantiating your SearchIndexClient? My hunch is that you've included the domain suffix in your search service or index name, which would trigger the error that you're seeing. Try setting SearchDnsSuffix
to "search.azure.us".