Defining scope configuration/solution targeting by ARM Template or Terraform - azure

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.

Related

Is it possible to define parameters through portal for Logic App (Standard)?

I have a single-tenant logic app and a workflow under it that needs a configurable input. In a multi-tenant logic app, one can define parameters through the azure portal and reference them in workflow definition (actions/ triggers). Is this not possible with a single-tenant logic app?
I am not able to find the answer in the documentation.
I know a deployment template should consult parameters file for this, however, I still have the above question specifically if I am doing stuff through the portal.
Edit 7/12
I am referring to the parameters concept explained here, and not the parameters tab of the triggers or actions. See below the parameters that we can define through the portal when working with the consumption logic app.
The answer is: not yet. Support for parameters in the designer (and therefore in the Azure Portal) is on its way, but not available yet.
In VS Code, you can create a parameters.json file.
But in the portal, there's no option (yet) to create/edit parameters.
Bec Lyons (Microsoft) demoed a version of the designer with this in it, although I can't remember if this was in the June Logic Apps Live session, or in the July Integration Down Under session.
In any case, the only currently supported way to do this is to create a parameters.json file and upload it.
You can either do this from VS Code or Azure CLI (using the preview logicapps CLI extension) OR you can FTP to your Logic App and upload it via an FTP client (e.g. FileZilla) - you can get the FTP login details by clicking the "Get Publish Profile" button in the overview of your Logic Apps Standard resource.
Once they release support for this in the Portal/Designer, I'll update this answer.
Also, worth noting that as of this date (July 2021), there are issues using parameters in Managed API Triggers - not sure yet if this is by design, or if it's a bug. Specifically the FileSystem, FTP and FTPWithSSH (SFTP) triggers.
Hope this helps. Probably not the answer you were looking for, though!

Is there any way to enable the Azure's management-api built-in rest API programmatically?

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?

Get ARM template for a specific API in Azure API Management

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.

Conditional ARM template deployment for APIM: only creating, not updating

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.

Azure Vitual machine deployment

Azure resource manager power shell or JSON template to create Virtual machine in existing Virtual network and Storage account.
You can of course use either.
Json Template is basically what Azure Resource Manager (ARM) uses anway. Bonus: you can run your ARM templates from PowerShell :)
The question you want to ask is:
Will I be doing this repeatedly?
If so, ARM is the natural answer. You create a resource in a file that you can version control and use to repeated deployments.
If it's only a one-time thing, then PowerShell or Azure Command Line Tools are more than enough.
At first steps JSON templates may confuse you, because files are large (hundreds of lines). But templates are really readable and you can easy configure your architecture. Also there is a chance to make a syntax mistake or to violate existing restrictions - try to use smart editor.
For example, VS Code Editor.
PowerShell and multi-platform tool Azure CLI help you make the same requests to subscriptions but contain helpers, hints and validators which would help you easy set correct options.

Resources