Awarded – Microsoft MVP 2nd time in a row

Gladly sharing that I’m awarded Microsoft MVP 2nd time in a row.

MVP-Image

Thank you Microsoft for the recognition again. I want to extend my thanks to all my friends and whosoever has supported me along the way! Thank you.

Microsoft Most Valuable Professional (MVP) award is given to “exceptional, independent community leaders who share their passion, technical expertise, and real-world knowledge of Microsoft products with others”. Please explore more on – What it takes to be an MVP

Time to cheer! 🙂 and get back to community work!! 😉

/Sunny.

[Powershell] Azure Automation – Delete all Azure Logic Apps in a Resource Group

In one of my recent projects I had a requirement to delete all the Logic Apps from a resource group on Azure. In this quick blog I’m sharing how to delete all the logic apps in one go inside a resource group using the following Powershell script:

Prerequisites:

  • Service Principal Account Credentials (ClientId / Secret)
  • SubscriptionId
  • TenantId
  • ResourceGroupName

Please refer to this blog if you don’t know where to get Service Principal Account Credentials – Managing Azure Logic Apps using .NET SDK.

Create the Service Principal Account and add a Contributor Role to it – for given subscription & resource group. You can find the commands in the blog mentioned above.

Script
———————————————————-
Write-Host 'Deleting Logic Apps...'
$resourceGroupName = <resource group>
$tenantId =<tenantId>
$clientId =<clientId>
$subscriptionId =<subscriptionId>
$secPassword = <secretPassword>
$secretPassword = ConvertTo-SecureString $secPassword -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($clientId,$secretPassword)
Login-AzureRmAccount -ServicePrincipal -Tenant $tenantId -Credential $cred
Select-AzureRMSubscription -SubscriptionId $subscriptionId -tenantId $tenantId

$logicApps = @()
Find-AzureRmResource -ResourceGroupName LogicApps -ResourceType Microsoft.Logic/workflows | ForEach-Object{$logicApps += $_}

write-host $logicApps.Count 'Logic App(s) found'
foreach ($logicApp in $logicApps){
    write-host 'Deleting Logic App :' $logicApp.Name
    Remove-AzureRmLogicApp -ResourceGroupName $resourceGroupName -Name $logicApp.Name -Force
}
———————————————————
Happy Learning 🙂

[Powershell] Export Self-Signed Certificate

 

$cert = New-SelfSignedCertificate -DnsName yourdomain.cloudapp.net -CertStoreLocation “cert:\LocalMachine\My”

$password = ConvertTo-SecureString -String “Password@1234” -Force -AsPlainText

#Generate .pfx
Export-PfxCertificate -Cert $cert -FilePath “.\my-cert-file.pfx” -Password $password

#Export to .cer format
Export-Certificate -Type CERT -Cert $cert -FilePath .\my-cert-file.cer