Sunday 20 November 2022

ARM Templates vs Bicep vs Terraform vs Pulumi

ARM templates, they are instructions that run against Azure to create resources.  

ARM templates will update settings such as tags when added, deleted or updated using json.
If a dependent resource is called e.g. storage, the ARM template creates the storage and if variables are supplied it shall use them.  Removing or changing the dependency won't update the dependent resource, it will create a new storage resource and point to the new storage. 
Note: Templates don't remove dependent resources if they are pulled from the ARM template. It will not upgrade to the latest instructions. I.e. it does not take the infrastructure to desired state config (DSC).
There is a DSC modules for ARM templates, but i believe this is more for VM's.

Bicep is a domain specific language which is DSC, it's json and way easier to build up your infrastructure.
Bicep will run ARM templates "under the hood" and provide the full desired state.  Bicep is a Microsoft Azure only concept and can be used for private cloud infrastructure.  

Terraform is an open source DSL to build IaC, and it works on AWS, Azure and GCP (and Oracle ...).
Terraform is created by HashiCorp, HashiCorp have an amazing tooling set that uses the Terraform language to build, and changes Infrastructure.  Uses the HCL Language.

AWS CloudFormation is the native way to build IaC on AWS.  Supports json and YAML.

Pulumi is an exciting competitor to Terraform.  Can us multiple languages and easy to write new modules.  Code is compiled and uses appropriate cloud API's to create IaC.   Compare Terraform to Pulumi.  Uses TypeScript/JS, Python or C#.  Pulumi is Open Source, and there is a free tier SaaS offering on Pulumi Cloud.

Common Dev setup could be: TypeScript with Pulumi created using VS code npm for packages.  
Pulumi needs a program yaml file, tells it the language to use and other setup.  2 types of providers: Terraform bridge providers and native provides.  There are over 150 connectors most are Terraform .  Support multiple languages e.g. TypeScript, C#, Python Java, YAML.  Easy to integrate into CI/CD/DevOps.  Pulumi is basically a command line tool that can be called from DevOps including Pulumi Cloud.


Pulumi (Any) vs Terraform (HCL lang) vs AWS: CDK (TS, C#, Py, Go, Java) or CloudFormations (YAML)  vs Azure: ARM/Bicep (DSL).

Nutanix - new to me but looks like VMWare using IaC for multi-cloud basically Terraform but manage and monitor.  Very likely to be wrong here.

Summary:
Use what the organisation uses, Bicep is great if you only are using Azure, and for smaller work/specific DTAP IAC using ARM templates is a well trodden route.  If the organisation wants multi-cloud (do not take multi-cloud lightly) then Terraform and even Hashicorp using Terraform is the way to go.  Terraform and Pulumi are for multi-cloud/run at a higher level than CloudFormation, ARM/Bicep.

Note: Resist multi-cloud at all costs, I've heard ridiculous reasoning like we don't want to be tied to only AWS or Azure.  That's cool but costs go up exponentially with multi-cloud, it's not even the infra that costs, it's the management overhead and testing/verification.  Which parts can be changed.  A business would need a really good reason to go to multiple vendors.

Power Apps issue with OptionSets Syntax irregularity

Problems: OptionSets in Power Apps (Canvas apps can be a little nasty to work with, today I took a couple of hours  trying to use an OptionSet to filter results.  This should have taken 5 minutes but there is a weird behavior when using switch or if statements to dynamically filter using options sets.

Hypothesis:  using if/switch logic when using an OptionSet in Dataverse to filter results in the code being change/interpreted incorrectly at run time. 

Resolution:  Use a variable to hold the dynamic OptionSet choice as shown above.  I hope this post can help anyone having issues relating to Option sets for filtering and updating.

In the example below I show how to Insert a new Row using a Patch where the row contains an OptionSet.  It's ugly but, it works...

On the Save...
Set(orgType, Blank());
If(
    <ddlOrgType.Value> = "Personal", Set(orgType, 'Org Type'.'Sole Trader'),
    <ddlOrgType.Value> = "Incorporated", Set(orgType, 'Org Type'.'Limited Company'),
    <ddlOrgType.Value> = "Partnership", Set(orgType, 'Org Type'.'Partnership')
    );
Insert the new row for Subject

Sunday 13 November 2022

Deploying a Canvas App direct to mobile devices

Overview:  Canvas apps have a feature called "Wrap" that can take a canvas app via a solution and allow it to be access naively on iOS and Droid.  This allow users to open the canvas app without going thru the Power Apps client on their mobile device.  The apps can be shipped using the app stores/marketplace or Microsoft Intune for enterprise deployment.

Enable the feature in your dev/un-managed environment using the "Power Platform Admin centre":

There is a great wizard that takes care of a lot of the underlying work such as registering the app in Azure Portal AAD.

Use the Wrap wizard (you'll need a lot of access rights on the Power Platform and Azure Portal)
Pick your package types, this post outlines the full process for Android (apk). Below shows the iOs file needed for the Apple store but you can distribute using InTune.