Get backends associated to an API Management Service - azure

Is there any way to get the list of backends of a specific API Management Service using Azure CLI?
az apim documentation does not have any method to list the backends.
I tried to iterate the operations of one of the APIs, but they don't have the backend information. Is it possible?

I tried to reproduce the same in my environment and got below results:
I have one API Management service named sriapim01 with below backends:
Note that, you can only use either PowerShell or REST API or ARM templates to list the backends of API Management service.
In my case, I used below PowerShell commands and got backends list successfully like below:
$apimContext = New-AzApiManagementContext -ResourceGroupName "rgname" -ServiceName "APIM name"
Get-AzApiManagementBackend -Context $apimContext
Response:
To list the backends via REST API, you can refer below MS document:
Backend - List By Service - (Azure APIM) | Microsoft

Related

How to get list of azure container images which are affected after security scans?

I know how to get repositories, we can use
az acr repository list --name myregistry.
But, how to get repositories with tags that are having security/vulnerability issues after security scans using azure cli?
There is no way to get repositories with tags that are having security/vulnerability issues after security scans using Azure CLI.
You can get the scan results (security vulnerabilities, recommendations) of the scanned resource using Azure Portal, Azure Resource Graph and REST API as given in this MS Doc.
If you have the assessment Ids, then you can get the scan results using combination of REST API and Az CLI Cmdlets:
REST API:
Azure CLI:
az rest --method get --url GET {api to get security vuls} --url-parameters

is it possible to list all types of app service using az cli

I am trying to list the type of app service associated with particular subscription using azure cli.
Type of app service:
Web apps
logic apps
Function apps
mobile apps
API apps
So far I have tried to find out the individual command for these. Out of which I could only get
web apps : az webapp list --subscription subscriptionId
function apps: az functionapp list --subscription subscriptionId
logic apps: az logic workflow list --subscription subscriptionId
I am not sure the above commands include the API apps and mobile apps or it filters.
Any help would be much appreciated.
You could use az resource list (see documentation) and apply a query filter
az resource list --subscription subscriptionId --query "[?type=='Microsoft.Web/sites' || type=='Microsoft.Logic/workflows']"
You could update the query filter based on your need.
As mentioned by #Sajeetharan, Mobile Apps, API Apps, Web Apps and Function Apps are part of App services (Microsoft.Web/sites)
Yes you are right, API apps and Mobile apps are part of the Appservice which falls under WebApps.
You could use the CLI command or use the REST API

How to get the azure VMUUID of azure VM?

I am creating an ARM template for the Azure Log Analytics workspace.it has some queries which use azure VM's VMUUID. Is there is any way to fetch the azure VM's VMUUID inside the ARM template or any other way to fetch azure VMUUID?
ARM Template I just need to get the values of VMUUID of all VM's in that subscription.
You can also get this information programmatically from the Azure Instance Metadata Service (IMDS). It provides information about currently running virtual machine instances. You can use IMDS to manage and configure your virtual machines. This information includes the SKU, storage, network configurations, and upcoming maintenance events. For a complete list of the data available, see the Endpoint Categories Summary.
IMDS is a REST API that's available at a well-known, non-routable IP address 169.254.169.254. You can only access it from within the VM. Communication between the VM and IMDS never leaves the host.
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service
Try Azure Resource Explorer
You could easily find it in the Azure Resource Explorer.
//One more extra reference: What is Azure Resource Explorer?
Just navigate to the Microsoft.Compute => virtualMachines view:
There is one more way to find it, but for me seems more complicated as you need to connect to the VM:
https://azure.microsoft.com/en-us/blog/accessing-and-using-azure-vm-unique-id/
Update: Try PowerShell
The simple PowerShell script below returns a list of all VMUUIDs in the specified subscription:
Get-AzSubscription
Select-AzSubscription -SubscriptionId "Olga's Subscription"
$GetVM = Get-AzVM
Foreach ($vm in $GetVM)
{
$vmId =""
$vmId = $vm.vmid
$vmIdList +=$vmId + "`r`n"
}
Write-Output $vmIdList
Please let me know if above answers your question.

Powershell script to get all app services linked with there certificates

Can somebody tell me how can I build a script that can list out all the app service certificates inside of an app services and app service plan that the app services are linked with inside of any azure subscription?
Based on the official documentation, Azure PowerShell does not support get certificate and service plan via the App Service Name . If you want to do it, you could get them via resource group.
1.Get Web App certificates in a resource group
Get-AzureRmWebAppCertificate -ResourceGroupName <resourcegroup>
2.Get App Service plans from a resource group
Get-AzureRmAppServicePlan -ResourceGroupName <resourcegroup>
For more details, refer to Get-AzureRmWebAppCertificate & Get-AzureRmAppServicePlan.

New deployment slot for azure websites

Is there a REST API call to create a new deployment slot in Azure website?
I am not able to find anything here.
You can do this using the Azure PowerShell cmdlets. For example, I tested this with a site named "cloudallocweb" in East US and then used the following command to create a new deployment slot in the cloudallocweb site.
New-AzureWebsite -Name "cloudallocweb" -Location "East US" -Slot "test"
Peeking into what the New-AzureWebsite cmdlet is doing in the command above, I found this POST operation which is basically the Create a web site REST API. Notice that it is passing the WebSpace setting (matching in the URL), which I don't see documented in the REST API.
At any rate, it appears the Create a Web Site REST API is what you need. This makes sense considering that a deployment slot is really just a web site. You may also take a look at the List Webspaces API to find the right web space value for your site.
Following the steps above, the new deployment slot will appear under the original site as shown here. You can then swap the deployment slots using the portal, REST API, or the Switch-AzureWebsiteSlot cmdlet.

Resources