Does azure Java SDK support metric collections? - azure

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.

Related

Azure services overview

I have many services on the azure plateform .instead of going on azure portal always and checking which services are running i want main parameters of azure services on my dashboard like pipelines successfully ran in data factory,storage used in data lake.so is there any api which can do or fetch this data?
Almost all the Azure resources have REST API exposed to get their status and key metric/attributes, so you need to write some script or code to pull these and display in your UI(may be simple javascript based). For example to get the pipeline run details, refer this

Automate updates from Azure Function App to API Management

Given that Azure Functions can be imported to API Management as described here, how do we keep the API up to date when Azure Functions change? For example, if the Function signature changes or a function is added or removed. How can this process be automated, so once the Azure Functions change, the changes are reflected in the API?
Microsoft's API Management team has a proposed solution here, but it's not clear to me how this solution can be applied with Azure Function App as the backed-end for the API.
Yes, you need to make it as part of your release process. After publishing the new version of Azure Functions, you'll import the new specification into API Management.
https://marketplace.visualstudio.com/items?itemName=stephane-eyskens.apim
Once you import and publish an API in APIM it will not be updated automatically. So, even though the developers released a new build, the consumers would still consume the older version of the API published in APIM.
Try to use Azure DevOps pipelines for continuous delivery of APIs to Azure API Management Service.
Add a create/update task, which will create or update the API in APIM based on the Swagger file and also set different API policies. This task will also update the API in APIM in case the Dev guy will create new API methods or remove API methods.

Does the Azure CLI use the Azure Rest API

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.

Can Azure Insights API be used for completely stand-alone custom metrics?

I am hoping I can put in some simple API calls in legacy systems so I can capture point-in-time metrics "somewhere" in Azure, so that I can then take advantage of the Azure Portal dashboard and metrics graphing. I looked into Insights SDK but that seems to require that whatever I'm running be deployed somewhere in Azure cloud. I just want to run a simple powershell script or simple .net console app that connects to a legacy database in our internal network, pulls very basic point-in-time counts for message processing backlog... and then pushes that info with a timestamp out "somewhere" for visualization.
Any ideas what I can use for this in Azure?
Thanks,
Andres
You can use the TrackMetric API in Application Insights SDK.
https://learn.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics

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

Resources