Azure: figure out if resource was deployed manually or via arm template - azure

Is there a way to figure out if resource was deployed manually (via Azure portal) or via arm template?

I would say that your best option, although it won't guarantee 100% accuracy, is to look at the deployment name. If you look at a Resource Group from the Azure Portal and navigate to Deployments, you'll see a list of all deployments to that RG.
From my observations:
if the deployment name is in the format Resource.Provider-Timestamp (Microsoft.RouteTable-20200824154745) it was done via the Portal
if the deployment name is somewhat friendly or irregular (VirtualWanDeployment) it was a manual ARM template deployment (PowerShell in my case)
if the deployment name is in the format resource-date-time-xxxx (applicationGateway-20200821-135645-bf71) it was an Azure DevOps pipeline

Related

Is there a way to deploy ARM template on every new subscription

I want to run deploy an ARM template on every subscription and on future new subscriptions.
In AWS there's stackset for the organization level and it's working.
How can I achieve the same result in Azure?
Thanks
You can use Azure Blueprint:
Blueprints are a declarative way to orchestrate the deployment of various resource templates and other artifacts such as:
Role Assignments
Policy Assignments Azure
Resource Manager templates (ARM templates)
Resource Groups

Where can I browse the Deployments that I made using the AzureRM_Template_Deployment resource of Terraform?

Recently I have started doing some Azure Data Factory deployments using the AzureRM_Template_Deployment resource in Terraform using Azure DevOps. I need to be able to browse all the deployments I made using this resource. When I open the Deployments folder in the Azure portal I do not see anything there. But I'm sure this deployment exists because if I use the same name for a future template deployment using Terraform, I get the below error:
resource with the ID "/subscriptions/***/resourceGroups/***/providers/Microsoft.Resources/deployments/<deploymentName>" already exists
Any help is appreciated.
I tried creating a storage account from the sample registry I found from azurerm_template_deployment Terraform Registry, after the deployment was successful, If I go to the deployment folder from portal I don’t find any . Its because we didn’t use the template on subscription level rather we used on resource group. We deploy the resources using the ARM template to the resource group that’s being created by terraform.
So, we can find the template deployment inside the resource group under the deployment blade as shown.

Referencing template in Azure Templates

I have an ARM Template stored in Azure Templates.
Is there a way to reference this template from script (either in Azure Cloud Shell or PowerShell/CLI on local machine)? Right now it seems the only way to deploy the template is through the Azure portal UI.
Update
I wanted to clarify what I am asking. I am asking specifically about Azure Templates (Preview) service. It seems that once you store a template in Templates service the only way to access it is through the Azure portal.
For example, let's say I am creating a VM in Azure portal. I can save the ARM template to Templates service as shown in the images below.
You can click on Download Template and parameters link, on next page click on Add to library to save the template to Templates service (Templates service can be found in Azure portal through All Service > filter for "Templates").
I was doing the course on edX.org: Automating Azure Workloads and it was talking about this service, that's why I became interested in this service.
You can deploy a template with every possible mean you mention. Not only the portal UI.
There is documentation here - section Deploy a template from external reosurce (also explains how to deploy from a private resource using SAS:
New-AzureRmResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName ExampleResourceGroup `
-TemplateUri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-storage-account-create/azuredeploy.json `
-storageAccountType Standard_GRS
The referenced documentation also provides sample for use with Cloud Shell.

Creating Azure PAAS Resource within DevTestLab through repositories

I am not able to Create Azure Paas resource "VirtualMachineScaleSets" within DevTestLab, which i am trying by uploading ARM Template to DevtestLab repository through VSTS. It gives "Authorization failed for template resource of type 'Microsoft.Compute/VirtualMachineScaleSets' error
Overall goal is to create "Service fabric cluster" within DevTestLab
MSDN link : https://learn.microsoft.com/en-us/azure/devtest-lab/devtest-lab-create-environment-from-arm
Because DevTestLab is different with Azure resource module. For now, Azure does not support deploy VMSS to DevTestLab.
By the way, we can't use the same template to deploy resource in DevTestLab, there are different resource.
More information about DevTestLab template, please refer to this link.
We have a fix working its way through our safe deployment pipeline. The fix will be deployed soon to all regions.
As a work around you could give "VS Dev Test Lab" application "owner" permission at subscription level and "owner" permission to DevTestLab created.

How do I find the properties of a resource with azure resource manager

How can I see the configuration of a resource in a resource group? I've provisioned a database through the portal and I'd like to see what that configuration is in the template language.
You can use the Azure Resource Manager REST API to list the template deployments for your resource group. A reference to the API is here.
Near the top of the response is a templateLink that you can follow to get the deployment template. For example, this is what I get back for one of my deployments where I used the Web App + SQL Database configuration from the Azure Portal to create a new web app.

Resources