Azure REST API - getting identity data - rest

In Amazon cloud API there is the possibility to get identity data, meaning data from the running instance - on which region it is, dns ....
is there the same option in Azure? as I am creating management system in which the server is installed on a virtual machine and I need to know to which region it is related, all this using REST API

In Azure you can use Azure API Management REST API to get all sort of information for Azure:
ex:
Lists all of the resources in a subscription:
https://management.azure.com/subscriptions/{subscription-id}/resources?$top={top}$skiptoken={skiptoken}&$filter={filter}&api-version={api-version}
For the complete documentation look at this page here:
https://msdn.microsoft.com/en-us/library/azure/dn776326.aspx
You can do similar things using Powershell scripts as well.

Related

Is it possible to retrieve Azure environment connection strings from the Kudu REST API?

I am accessing the REST API for Kudu as documented at https://github.com/projectkudu/kudu/wiki/REST-API.
Using the GET /api/settings endpoint I am able to retrieve the application settings configured in the Azure portal, however it does not include the connection strings configured in the Azure portal.
I'm not seeing any other endpoints that would include this information - is there any way to retrieve the connection strings?
There is no Kudu API to do this. However, the recommended approach to get both APp Settings and Connection Strings is to go through the Azure ARM API.
e.g. to get Connection Strings:
POST https://management.azure.com/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Web/sites/{appname}/config/connectionstrings/list?api-version=2016-08-01

Get relation between Hosts and Datastores using vSphere Automation REST API

I'm trying to create VM using vSphere Automation SDK REST API and vRealize Orchestrator but the workflow in Orchestrator I'm using needs the host and datastore on which to create the VM (I'm cloning a VM using a template).
My problem is that my datastores are not shared by all clusters (and hosts) so I need to be careful to create a VM with a matching host and datastore.
With the vSphere Automation SDK REST API I can easily get the list of hosts and datastores (here's the doc I found : https://code.vmware.com/doc/preview?id=4645), but none of the "list" or "get" requests give me links between hosts and datastores.
How can I get the relations between my datastores and my hosts so that I can call Orchestrator with the correct parameters ?
Thank you.
Check out https://github.com/doublecloudinc/vim-rest-api
The REST APIs supports FULL features of vSphere APIs, and scales across many vCenter/ESXi servers. You can list all the host and pick one to get its datastore property easily with a couple of REST calls.
Also, vBrownBag tech talk: https://youtu.be/EpMlP27gEEM
Disclaimer: I am the creator of the REST APIs.

Does Microsoft Azure have a REST API to view information about Backup Vaults?

I'd like to consume information about the Recovery Services that I have setup in Azure. If I go to that section inside the Microsoft Azure Management Portal, I'll see a list of the Backup Vaults that I have created. I'm looking for an API that will let me pull up data about it, such as the one that is presented on the Dashboard:
- Name
- Status
- Location
- Storage used/left
- etc.
So far, I've only been able to find their Storage Services REST API.
Thank you
I asked the same thing on the MSDN forums. Apparently, as of this date, there is no API that can be used to pull in that information.
Source: reply from MSDN forums
2016 update: While not documented so far as I can tell, if you do some network sniffing of the various Recovery Services powershell cmdlets you will find that the management.azure.com API supports basically everything Azure Powershell supports.
Obviously be careful using anything undocumented though...

List Azure Virtual Machines via REST API

I am currently attempting to get a list of all of the Virtual Machines that I have running under a Windows Azure subscription programmatically. For this, I am attempting to use the Azure REST API (https://management.core.windows.net), and not use the power-shell cmdlets.
Using the cmdlets I can run 'Get-AzureVM' and get a listing of all of the VM's with ServiceName, Name, and Status without any modifications. The problem is that I cannot find anywhere in the documentation of how to list out the VMs via the API.
I have looked through the various Azure REST API's but have not been able to find anything. The documentation for VM REST API does not show or provide a list function.
Am I missing the fundamentals somewhere?
// Create the request.
// https://management.core.windows.net/<subscription-id>/services/hostedservices
requestUri = new Uri("https://management.core.windows.net/"
+ subscriptionId
+ "/services/"
+ operation);
This is what I am using for the base of the request. I can get a list of hosted services but not the Virtual Machines.
You would need to get a list all the Cloud Services (Hosted Services), and then the deployment properties for each. Look for the deployment in the Production environment/slot. Then check for a role type of "PersistentVMRole".
VMs are really just a type of Cloud Service, along with Web and Worker roles. The Windows Azure management portal and PowerShell cmdlets abstracts this away to make things a little easier to understand and view.
Follow these steps for listing VMs:
List HostedServices using the following ListHostedServices
For each service in from the above,
a)GetDeployment by Environment(production or staging).
OR
b) Get Deployment By Name.
In either case, get the value for Deployment.getRoleInstanceList().getRoleInstance().getInstanceName().
You can use Azure node SDK to list out all VMs in your subscription
computeClient.virtualMachines.listAll(function (err, result))
More details on Azure Node SDK here: https://github.com/Azure-Samples/compute-node-manage-vm

Get metrics via API

I'm using Azure SQL, and there is a page in there with metrics
From what I understood the new Azure Managment Portal consumes only public apis. What I'm trying to find out is how to access these metrics via a REST or SOAP api. I've searched through the MSDN documentation but couldn't come up with anything.
Anyone have any ideas?
I presume Microsoft did not provide Azure Database monitoring REST or SOAP API as it would not be used much.
DBAs can connect to Azure Database and gather all the necessary statistics via dynamic management views which are quite powerful.
However, I do not have any article / documentation confirming my presumptions.
try the new sys.event_log and sys.database_connection_stats DMVs instead.
see: Announcing: New System Views for Windows Azure SQL Database