In the Azure API portal there is the Automation script tab, but that generates the ARM template for the entire resource group. It also includes a lot of other stuff that needed.
Is there a (simple) way to get hold of the ARM template for a specific API rather than the entire resource group? Can it be done through Azure cli? the REST API?
Yes, use the Azure Resource Explorer to locate your resource, the Uri at the top of the page will provide you a link to the template (requires authentication if you want to call it from outside of Resource Explorer).
I also always refer back to the reference documentation on ARM templates, it is a very good place to start from. Whilst it doesn't give you your exact template, it does give you a very clear base to start from (example below). I find this far more productive that trying to read the templates in the Automation Script" section of the portal.
Good luck.
No, you cannot do that. there is only 1 resource provider action to export and it exports the whole resource group. just remove all the extra parts.
Related
I have an Azure webapp and normally if I want to block an IP address, I go to Azure dashboard panel and under networking>Configure Access Restrictions, I add a rule to do so. This picture shows which menu item I mean:
However, I would like to do this programmatically. I see that the documentation shows how you can do this through Powershell.
I have also managed to find the API documentation for WebApp. But I can't find the last piece of the puzzle which is the API that does what I need.
Can someone please tell me if it is possible and which API I should use? Thank you in advance.
According to the doc: Use an Azure REST API PUT operation on the app configuration in Azure Resource Manager. The location for this information in Azure Resource Manager is:
management.azure.com/subscriptions/subscription ID/resourceGroups/resource groups/providers/Microsoft.Web/sites/web app name/config/web?api-version=2020-06-01
Then I searched the Azure Rest API and found this:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web?api-version=2019-08-01
We could update the field properties.ipSecurityRestrictions to update the value of Access Restrictions.
In addition, you could also check this blog: Bulk add IP Access Restrictions to Azure App Service using Az PowerShell
There does not appear to be a one-to-one match between powershell commands and api.
The closest I could find is:
https://learn.microsoft.com/en-us/rest/api/appservice/webapps/putprivateaccessvnet
This allows you to define which vnet has access to your web app. By controlling access to your vnet, you can control access to your app.
I have Automation Account linked with Log Analytics Workspace and Updates solution enable on it. Evrything has been created automatically by ARM Templates or Terraform code and I am trying to find any way how can I add solution targeting for Update Management only for particular VMs. When I add this solution by Azure Portal and link Automation Account with Log Analytics workspace from Update Management menu, it added automatically "MicrosoftDefaultScopeConfig-Updates" scope.
Is there any way to add scope by ARM Template or Terraform code? Or maybe with other automatically way for example as Powershell script?
Related / Duplicate question is raised in this MSDN thread; Just sharing this for the benefit of broader audience who might face similar issue and might look for an answer.
My question relates to Azure API-Management-service and ARM templates. I have to be precise because of the redundant terms with different meanings. So forgive my unusual explanation.
Azure has a management-api resource that behaves like an api-gateway. Let's call it gateway-x. This resource has a feature called "Management REST API". You can enable this feature in the azure portal. Activating this feature provides a REST API that can interact with gateway-x
https://learn.microsoft.com/de-de/rest/api/apimanagement/apimanagementrest/api-management-rest
gateway-x was created through ARM templates. Unfortunately, it looks like there is no property for activate the "Management REST API" as I could do in the web-portal. Is that correct? I was also looking for a workaround using the azure-cli to do that. "az apim" but nope, it can basically nothing.
I need that rest API available within my CI/CD pipeline. Doing this manually is not an option.
Any Ideas?
I have a specific requirement for ARM templates and Azure API Management, so this question is different than other conditional ARM deployment questions.
Some background:
My APIM instance is deployed using ARM templates, however custom domains need to be setup but cannot be part of it. This is because my customer stores their certificates in a different system.
This means the custom domains are setup separately (manually) for the APIM instance, right after the instance was created by the ARM template.
The ARM template also applies the global policy and creates the products. I use a linked template setup.
The issue arises when we want to update something on the APIM instance, like extending the global policy or adding a product. Then the ARM template will also update the instance, but should leave the custom domain section untouched. According to the documentation, using 'incremental' mode leaves resources not in the ARM template untouched. So I thought to solve it by just leaving out the 'hostnameConfigurations' section in the ARM template. However it seems the ARM template doesn't ignore it, but interprets it as empty and effectively removing the custom domains from the APIM instance!
This doesn't seem like normal behavior, but I have to live with it. To solve this I have a couple of options.
One of them is extracting the global policies and products from the generic APIM ARM template, so I can skip the APIM instance part when updating. This would mean I have to run multiple separate ARM templates on creating the resources.
The solution I'd like to go for, is to conditionally deploy the ARM template creating the APIM instance, to only creating. I want to skip this linked template when the resource already exists.
I though I could do this by getting a reference to the APIM instance, but according to the documentation "The reference function derives its value from a runtime state, and therefore can't be used in the variables section.".
Question: Is it possible to conditionally deploy a linked ARM template, based on the fact whether a resource already exists or not?
The answer is no. You cannot really do that. Unless you are investigating different hacky ways. You can call Azure function to decide if the resource exist. You can use an output from the deployment to decide if the resource exist. But straight up there is nothing that can help you. only different hacks.
I'm trying to set a standard virtual machine template via ARM deployed on the azure portal and feel I'm missing a trick.
When deploying a virtual machine via azure you can select existing vnets and based off your selection you can select a subnet.
Via the ARM template deployment method I do not see a way other then putting all the subnets in the allowed values and hoping the end user chooses the right one.
Can anyone help?
theres no easy way of doing this currently. Managed Applications might be of a value there, but they are not exactly arm templates. But they have some controls to allow for "smart" value picking.
I suppose I can generate a powershell script that queries azure dependant on selections and fill in the arm template from said selections. Just would be nice if could have built in the intelligence within ARM deployment.
Thank you for the managed applications information