Does the Azure CLI use the Azure Rest API - azure

Does the Azure CLI SDK use the Azure Rest API internally? And if so any further details on how these relate to each other internally would be great.

Yes, you are right. Azure CLI uses Azure Rest APi.
If you use --debug, you will find the API the command use. For example:
az vm list --debug
Yes, as Johan said, Azure Power Shell/CLI, SDK all call Azure Rest API. If you use debug mode, you could see the API. More information about Azure Rest API, you could check this link.

Each service in Azure exposes a set of APIs. For managing/creating/updating your resources (e.g. creating a Virtual Machine), these are REST calls. Note: Other services may use non-HTTP/REST APIs (e.g. AMQP for Azure Service Bus).
While you can use your favorite HTTP networking stack or utility (e.g. curl, postman etc.) to make HTTP/REST calls, Microsoft publishes a set of SDKs to make things easier to develop applicationsin various languages.
The Azure CLI happens to be implemented in python, and thus makes use of the Azure Python SDKs to get its work done.
There is no separate Azure CLI SDK, however.

Related

Does azure Java SDK support metric collections?

I am looking at the GitHub repo and (https://github.com/Azure/azure-sdk-for-java) and I can't seem to find any example on how to obtain the metrics from Azure environment. Is it even supported by the SDK ?
You can refer to the sample code in the Azure SDK for Java GitHub code repo for example on how to get the Azure Storage Account Usage Metrics.
You can also get the test result of the sample code here.
Update 1:
You'll need to use the Azure Monitor REST API for retrieving the granular level metrics for Azure resources such as Virtual Machine or Storage Account.
List metrics for a resource in Azure Monitor REST API
E.g. For retrieving metrics for virtual machine, issue GET request with the below sample REST API.
GET https://management.azure.com/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute/virtualMachines/{virtual_machine_name}/providers/microsoft.insights/metrics?api-version=2016-09-01
At present, Azure SDK for Java does not have the package which supports the Azure Monitor REST API as above. You will need to use some REST client and custom code to manage the REST APIs calls for your usage.

How to use my own API instead of using mobile API in Azure

is there any way to publish my API in azure mobile service API instead of using its own. I want just to know it, because assume I have a backup server in amazon and as you know I don't have access to azure sdk in there and it means technically I cant use the API anywhere outside the azure.
Azure mobile services is actually based on the .Net web api in their C# flavor and on node.js on the Javascript side. You could surely write an API using those technology and have the same behavior. You will gain the fact of being more portable, however you will lose some of the preconfigured stuff from Mobile services.
If you are using .NET, please check this to see how to build a Web api! http://www.asp.net/web-api.
If you are using Javascript, here is where you should start : https://nodejs.org/
Both tech are quite easy to learn and super powerfull, have fun! When your API is built, you could just publish them as an azure Web APP (http://azure.microsoft.com/en-us/services/app-service/web/) or an Azure API (https://azure.microsoft.com/en-us/services/app-service/api/) instead of the mobile App
Hope it helps, if you have more questions, please ask!
You can create and publish your own custom APIs in azure mobile service. You could even access in via azure mobile service sdk in client by using "InvokeApiAsync<>()" method.
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn614130.aspx
If you want to access the api via fidder/httpclient than AZM SDK, pass the mobile service key in HTTP header as Name:'x-zumo-application' value:'application key from portal'

Windows Azure Mobile Services REST API documentation

Is there any management API in Windows Azure Mobile Services? For example: methods to create mobile services or data tables. I could not find any documentation. I have read in some other thread that the API is available but not available publicly. Any expectation about its availability.
There is no REST API for managing Windows Azure Mobile Services, for operations like you mentioned (creating / configuring services; creating / configuring tables; etc). If you want to script those operations you can use the Azure command-line interface - that will let you perform those operations in the command line (for example via a batch / shell / command line script). That tool is implemented in node.js, so you can also use it in a node.js application, by using the azure-cli package.
There is a REST API for using a specific Azure Mobile Service - and you can find the documentation for it at http://msdn.microsoft.com/en-us/library/windowsazure/jj710108.aspx.

Deploy Azure Package from my own WPF App

I am creating a little utility app for some of my Azure work and i would love to make it possible to deploy a azure package from within my tool.
I have a package that have been created from Visual studio and i can manual deploy it or deploy it from within VS 2012.
Anyone who know a guide or can tell me how i would deploy it from my own application?
Yes, you can do that. Everything you see as far as deployment is concerned in VS is backed by a REST API. So you could essentially write a WPF application which is a wrapper over these REST API. There're two things you would need to do:
Upload Package files to blob storage: This would be the 1st thing you would need to do. You could make use of storage client library or implement REST API for uploading package files to blob storage.
Implement "Create Deployment" Service Management API function: Take a look at the functionality here: http://msdn.microsoft.com/en-us/library/windowsazure/ee460813.aspx. Once you have uploaded the package file in blob storage (and got the blob URI), you could invoke this functionality.
As far as I know there is no API wrapper / SDK available that covers full functionality on managing Storage Accounts, Deployments etc. yet. You can use the Windows Azure Management REST API though.
In order to use this API you need to have a valid management certificate in the subscription you want to manage and sign all REST calls to the Management API with it. There should be sufficient information about how to do so in the link above.
HTH

Is there a way to call Windows Azure Service Management REST APIs without writing program code

We are looking for a tool which can call Windows Azure Service Management REST APIs directly (i.e. without writing source code) so that operators can easily call them.
What we found so far is:
Fiddler cannot call them. [Source: Get Hosted service details with GET Request URI with fiddler ]
cURL can call them. [Source: http://social.msdn.microsoft.com/Forums/en-AU/windowsazuremanagement/thread/f1cf3322-a8e3-4179-a35e-6bfb2fd55075 ] So we now use cURL but cURL is a CUI program but GUI program is much easier for operators. And we need extra work to convert certificate (=.pfx) to .pem.
Windows Azure PowerShell Cmdlets ( http://wappowershell.codeplex.com/documentation ) is also one of our options now but it is much better if we can call REST APIs directly. The reasons are 1)testing purpose. Some time we want to call REST API, not wrapped one. 2)There is some time lag before the Cmdlets implement REST APIs. (If I remember correctly, when Storage Analytics was introduced we need to call REST API to use it. But there was no Cmdlets at that time.)
How about using the BURP Tool? Burp is a great Java based tool to use REST API directly in the GUI. You can use Burp tool to setup the PFX certificate used with Azure Management and then just type REST API and parameters to send request and get response.
You can download the tool below:
http://portswigger.net/burp/proxy.html
I tested the tool today and then written the following blog to explain how to configure Burp to Manage Windows Azure subscription and services using REST API.
http://blogs.msdn.com/b/avkashchauhan/archive/2012/05/16/windows-azure-management-using-burp-java-based-gui-tool-and-rest-api.aspx
In addition to Azure Powershell Cmdlets, check out Cerebrata's Powershell Cmdlets # http://cerebrata.com/Products/AzureManagementCmdlets/

Resources