How can I use one parameter file for templates that use some different parameters? (Azure LogicApp deployment using Powershell in DevOps Pipelines) - azure

So I am working on a project right now and I am facing an issue. In the company I work at we use two different resource groups, one for demo and then for productive. Before now we used to manually copy every new Logic App from the demo account and change the parameters so that it uses the correct ones for productive. We have around 80 logic apps as of now, and we seperate them in groups. The objective is to make it much easier and with as little as possible manual work required.
We are using them to sync SQL tables, CRM data and a lot of other stuff together. So I have many logic apps that use different parameters. For example, one can sync from the Calender to the SQL server, and the other one syncing two SQL tables but each table has to be accessed with a different user. What I want to do is have 6-7 parameter files depending on the sync. But when the deployment sees that I have parameter values that arent being used by a template, the deployment fails with the following error that makes it necessary to create a new parameter file for almost all new logic apps:
Code=InvalidTemplate; Message=Deployment template validation failed: 'The template parameters 'sql_server......' in the parameters file are not valid; they are not present in the original template and can therefore not be provided at deployment time. The only supported parameters for this template are 'logicAppName, logicAppLocation........ sql-8_username, sql-8_password, sql-8_sqlConnectionString'. Please see https://aka.ms/arm-deploy/#parameter-file for usage details.'.
Is there a way to make these parameters optional so that each templates uses the ones it needs? I googled around but the main thing I found did not help much => https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-best-practices#parameters
Thanks a lot for any help you guys can provide!

You can make it optional to provide a value for a param by using a defaultValue.
Any defaultValue supplied for a parameter must be valid for all users in the default deployment configuration.
Do not provide default values for user names, passwords (or anything that requires a secureString) or anything that will increase the attack surface area of the application
Do not use empty strings as default values (use language expressions to facilitate the scenario)
Template expressions can be used to create default values
Reference: https://github.com/Azure/azure-quickstart-templates/blob/master/1-CONTRIBUTION-GUIDE/best-practices.md#parameters

Related

How do you tell entity framework to create / deploy a database in Azure?

I'm using Entity Framework with a code first model; I've got my InitialCreate migration setup and working locally, I can run code against my database context, and everything works.
But when I deploy my project to Azure, I just get a connection string error ("Format of the initialization string does not conform to specification starting at index 0.").
I can't seem to find where in the Publish dialog are the options to create the Azure database. -- Do I have to create the database separately and hook them up manually? -- If so, what exact process should I follow. Does the database need to have contents?
I thought Microsoft was making a big deal that this could all be done in a single deploy step, but that doesn't seem to be the case from my current experience.
When you publish your project in the publish dialog, there is an option for the code first migration in the Settings tab, it will automatically show your data context and it will give you the option to set the remote connection string, and this will add a section in web.config to specify the data context and the Migration class to run during the migration process.
It will also allow you to set if you want to run the code first Migration or not.
You can also take a backup from the dev and clear the data then upload it to Azure SQL DB, this way the code first data context will check at first connection and it will find the code an database the same

Building LDAP Query that removes groups in a different domain

I need to build a query that pulls in all users with the *domain.com that are inactive.
(&(userPrincipalName=*domain.com)(!userAccountControl:1.2.840.113556.1.4.803:=2)
This is no problem, the problem is that there is another domain that has groups that are named the same as the production groups. So i tried something like this and it didn't work. I am trying to pull in the groups that are not in the dev domain.
(&(objectcategory=group)(!(ou:dn:=dev)))
I've also tried
(&(objectcategory=group)(!cn=dev.top.domain.com))
Edit: There are two potential ways to do Active Directory within the SharePoint tool. "ActiveDirectoryCustomQuery" and "ActiveDirectoryCustomFilter". I'm using the latter.

IISConfig.exe arguments for custom action in Microsoft Release Management

after creating an application pool in IIS(8.0) using Release Management 2013 Update 4, I need to customize the predefined action.
I would like to set Load User Profile in the advanced application pool settings true instead of false. I assumed I could use -loadUserProfile as an argument in Release Management.
Apparently the arguments are not similar to the parameter names in IIS. The release was rejected and the log file showed: ERROR: loaduserprofile : Unknown Option.
Release Management is using IISConfig.exe to execute the arguments. Even knowing that, I was unable to find a list of arguments or "Options" which can be used for the IISConfig.exe.
I would be glad to know how to solve that Problem. Not only in that specific case but in general.
Find the details of the IIS tool here:
https://msdn.microsoft.com/library/vs/alm/release/overview
Scroll to IIS Deployment Agent.
There does not seem to be any way to change the Load User Profile. You can write your own tool to accomplish that (and share it here :))

Bootstraping an application, is triggers a good idea?

I'm a building an internal webb application for components of building parts. I have table with projects which is tied to some other tables. When a user creates a new project, I want to "bootstrap" the project with a default categorization schema, which the user then can modify for his/her project. So I need to do some copy from a default schema and tie it to the users project.
I'm running NodeJS on backend, AngularJS on frontend and postgres as db. Where is the best way to put this logic? Either I use triggers on the db. The trigger is activated when a new post is made to the project table. Or, I'll do it with complicated queries in Node. Or is there some other way? Is there a best practice? It's probably "easier" to do a trigger. But I worry about the maintenance and testing of the app.
Since the issue that you have is related to the state of the database, you should solve it inside the database. There are basically two ways of solving this:
Revoke the insert privilege on the project table. Create a function new_project() that has parameters for all the required initial state of the project. Inside that function you create schema, do some copying, setup privileges and populate the tables with the parameter values.
Revoke the insert privilege on the project table. Create a view that has all required columns from all relevant tables to make a valid initial project and create an INSTEAD OF INSERT trigger on the views. In the trigger function you perform all the required steps as above.
Debugging code on PostgreSQL is not very advanced but whether or not you place you code in PostgreSQL or on the application side, you will have the same issues. The advantage of PostgreSQL is that the bug - if any - is never far away from where you code operates.

Windows Azure Table: C# API for Update/Merge?

Windows Azure Table has two distinct mechanisms for altering an existing entity: Update, which modifies properties in place, and Merge which replaces the entire entity.
Which of these is used when you call TableServiceContext.UpdateObject()? (I'm guessing Update.) And is the other one exposed at all through this API?
(Apologies if this is right under my nose in the docs and I'm not seeing it.)
Actually, it's Merge that modifies properties in place, and Update that replaces the entire entity.
I believe the storage client library does a merge by default, but I think you can use SaveChangeOptions.UpdateAsReplace to modify this behavior.
An easy way to test/verify this is to run a debugging proxy like Fiddler and just see what happens over the wire.

Resources