My goal is to fetch all the resources from the azure to our local database. I've been able to fetch various types of resources (virtual machines, websites, storage accounts etc.) using C# SDK (https://github.com/Azure/azure-sdk-for-net). However, it seems there's no wrapper for DocumentDb resource, what's more, I can't event find an endpoint to query it. Do you know how to fetch all DocumentDb resources ?
Asked
Active
Viewed 111 times
0
-
Look at [this](http://stackoverflow.com/questions/30728142/exporting-data-from-azure-documentdb) SO question. – Jeroen Heier Nov 23 '16 at 16:16
-
@JeroenHeier - I don't think the OP is talking about extracting data from the database; just the info about their resources. – David Makogon Nov 23 '16 at 20:46
-
Yeah exactly, I'd like to fetch all information about my DocumentDb resources. Generally, see the subset of information available in Azure Portal. – macpak Nov 24 '16 at 08:28
1 Answers
0
Try something like this powershell cmdlet
Find-AzureRmResource -ResourceType "Microsoft.DocumentDB/databaseAccounts"
Unfortunately, this doesn't seem to work exactly as expected, which is kind of weird. If I run this
Find-AzureRmResource -ResourceType "Microsoft.Storage/storageAccounts"
It outputs all the storage accounts. Go figure...
edit: Yes it is working fine. I was looking in the wrong subscription for docDbs... idiot.
As for doing it with REST, @macpak I haven't done it myself, but I suspect you could do something like:
GET https://management.azure.com/subscriptions/yourSubId/resourceGroups/yourResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts?api-version=2016-03-31
This is how https://resources.azure.com works, check it out. Obviously you parameterise the subId and RGname and build the URI. You would also need to get a bearer token and put it in the authorisation header. Use postman and/or fiddler..

Edward Rixon
- 1,199
- 1
- 17
- 31
-
Find-AzureRmResource -ResourceType "Microsoft.DocumentDb/databaseAccounts" is working for me. – ArTrejo-MSFT Nov 23 '16 at 22:07
-