Posts

Showing posts from July, 2024

bicep - using conditional when creating resources

To use conditional in Bicep, you can just specify "if" as shown below. Also we can place a param that pass from command line during deployment. param deploy bool @ description ( 'Location for all resources.' ) param location string = resourceGroup (). location @ description ( '' ) resource serviceBusNamespace 'Microsoft.ServiceBus/namespaces@2021-06-01-preview' = if ( deploy ) {   name : 'mytestservicebusjerwo'   location : location   sku : {     name : 'Basic'     capacity : 1     tier : 'Basic'   } } resource serviceBusQueue 'Microsoft.ServiceBus/namespaces/queues@2022-01-01-preview' = if ( deploy ) {   parent : serviceBusNamespace   name : 'myqueue'   properties : {     lockDuration : 'PT5M'     maxSizeInMegabytes : 1024     requiresDuplicateDetection : false     requiresSession : false     //defaultMessageTimeToLive: 'P10675199DT2H48M5.4775807S'     deadLetteringOnMessageExpiratio

bicep - we can specify different API to use for different resources

 we can specify which api version to use in our bicep file and it would still work with an existing resources.  For example, if I create my Azure service bus resources using, Microsoft.ServiceBus/namespaces/queues@2022-01-01-preview, i would still be able to change/update using a different API version for example, Microsoft.ServiceBus/namespaces/queues@2022-10-01-preview. These API are real and not made up.  On top of that, we can even use different API for resources in a bicep file.  For example, service bus namespace uses Microsoft.ServiceBus/namespaces/queues@2022-01-01-preview, which queue uses Microsoft.ServiceBus/namespaces/queues@2022-10-01-preview - We still able to get it to work.

bicep to see what are the infrastructure changes with --what-if

Image
If you wanted to see what are the changes that will be made to your Azure resources defined in your bicep files. please use the --what-if command as shown below: az deployment group create --resource-group exampleRg  --template-file servicebus.bicep --what-if  Sample output will be shown below:

app gateway lab1 - setting up app gateway for vm

Image
  To get started  1. create your app gateway - Goto Azure -> Create Application Gateway Resource group: aprg Application Gateway Name: ap Tier: Standard: V2 Enable autoscaling: No  Instance Count: 1  Availability zone: Zones 1 Under Virtual Network - Create your virtual network if you do not have one. Please note you need to create a default and another subnet for backend pool.  The portal does not allow you to add another subnet which you may need to add later.  In the front-end, ensure you create a public IP by clicking on "Add new". Under backend tab click on "Add a backend pool".  Name: APBackendPool Add backend pool without adding target: Yes Click Add. Configuration Under the configuration tab, click on "Add a routing rule".  We will only be configuring HTTP rules to port 80.  Rule name: HttpRoutingRule Priority: 100 Listener tab In the Listener tab, use the following settings for a listener.  Listener Name: HTTP Front end IP: Public IPv4 Port: 80

Azure Kubernetes Service Automatic

Azure Kubernetes service Automatic is an AKS comes with pre-configured components such as Azure linux OS, container insights, managed Grafana, managed Prometheus and many other components that you can see here . It even perform automated upgrades for you and this is something that you can configure as well - like every weekend. FYI: container insights, managed grafana and managed prometheus can be disabled during setup.

Azure load balancer - setting up load balancer and vm as backend pool

Image
  In this example, we are going to setup an Azure public load balancer and backed by Azure VM backend pool. To get started we will do the following  - Create virtual Network  Goto Virtual Network -> Create -> Then provide the following configuration  Resource group: mylbrg Virtual network name: lbvnet Security: Do not do anything here  IP Address:  Default: 10.0.0.0/24 BackendPoolSubnet: 10.0.2.0/24 Review and create. - Create 1 VM with a public ip and setup IIS  Goto Virtual Machine -> Create  Resource group: mylbrg Virtual machine name: VM`1 In Networking tab, ensure you create a new Public IP for your VM.  Subnet  is: BackendPoolSubnet Enable  Inbound port  for: http, https and RDP  Leave the rest as it is. Click on  Review and Create .  Once your VM is up and running, goto cloud shell and run the following command to setup IIS Set-AzVMExtension -ResourceGroupName mylbrg -ExtensionName IIS -VMName VM1 -Publisher Microsoft.Compute -ExtensionType CustomScriptExtension -TypeHa