How to rename existing Azure Logic App? - azure

I have created a logic app, but now I want to rename existing logic app in Microsoft Azure portal.
I have been looking for options, but could not find one.

You cannot rename web app as far as I'm aware. You can redeploy using different name and then delete existing one.

Select the LogicApp, clone it with a new name, delete the old one.

Existing logic app cannot be renamed. we can clone the existing logic app with a new name.
However,the cloned logic app will be created in the same resource group of the existing logic app. we can change the resource group or location of the logic app once the cloning is completed, but in order to avoid any run time error we need to update the subscription/Resource group name or id in the code view.

You can't rename Logic App... however you can redeploy it in minutes using PowerShell
If you just want workflow definition then
$rg = "my-resoruce-group"
$logicAppName = "my-logic-app"
$newName = "my-new-name"
$logicApp = Get-AzLogicApp -ResourceGroupName $rg -Name $logicAppName
New-AzLogicApp `
-ResourceGroupName $rg `
-Name "New-Name" `
-Definition $logicApp.Definition `
-Location $logicApp.Location
Or export entire resource as ARM template and reploy it either via PowerShell, CLI or through portal
$rg = "my-resoruce-group"
$logicAppName = "my-logic-app"
$logicApp = Get-AzLogicApp -ResourceGroupName $rg -Name $logicAppName
Export-AzResourceGroup `
-ResourceGroupName $rg `
-Resource $logicApp.Id `
-Path "arm.json"

One cannot able to rename the logic app , you can able to clone the logic app with the option available in overview section of logic app as available in below picture and provide the new name. Once the new logic app gets created we can delete the old logic app.

Related

Azure Cloud Services Extended Support Deploy using New-AzCloudService powershell. Set swappable cloud service

Few days ago I moved my service from Azure Cloud Services classic to Cloud Services extended support. The latest doesn't have Production/Staging slots. There is a new swap mechanism that is activated if during a deploy we configured the "swappable cloud service". I can do it using Visual Studio publish magic and it works fine.
Now I want to make a deploy using powershell script. The code below just creates a new deploy without activated swap. It works fine.
New-AzCloudService -Name $stagingName `
-ResourceGroupName $resourceGroupName `
-Location $location `
-ConfigurationFile $cscfgFilePath `
-DefinitionFile $csdefFilePath `
-PackageFile $cspkgFilePath `
-StorageAccount $storageAccount `
-KeyVaultName $keyVaultName
I didn't find any samples or clues of how to add the "swappable cloud service" to the New-AzCloudService. I figured out there is such settings in
NetworkProfile.SwappableCloudService.Id but I can't understand how to set it up properly. For example, if I add:
$production= Get-AzCloudService -ResourceGroup $resourceGroupName -CloudServiceName $productionName
$production.NetworkProfile.SwappableCloudService.Id = $production.Name # just to reuse the object
$loadBalancerConfig = CreateLoadBalancerConfig
$networkProfile = #{loadBalancerConfiguration = $loadBalancerConfig; swappableCloudService = $production.NetworkProfile.SwappableCloudService }
New-AzCloudService -Name $stagingName `
...
-NetworkProfile $networkProfile `
I got the error:
New-AzCloudService : Parameter set cannot be resolved using the specified named parameters
Is it possible to set the "swappable cloud service" for New-AzCloudService? How to do it?
Is it possible to set the "swappable cloud service" after the deploy (in any way, Azure portal, API, powershell, etc.)?
I suspect the issue relates to the -NetworkProfile not being supported when -ConfigurationFile, -DefinitionFile, and -PackageFile are used.
In the documentation, -NetworkProfile is used with -PackageUrl and -Configuration instead.
I've asked Microsoft about this as I am having the same issue.
Try $production.Id instead of $production.Name. Or $production.id (I am not sure if the case is important).

Remove-AzDeployment does not remove the resources created

I am creating a StorageAccount & Containers using ARM script
I use New-AzDeployment to create the resources. The resources are created properly. I want to remove the deployment
When I run Remove-AzDeployment -Name ; the deployment is removed, however the resources are not deleted.
How do I ensure that the resources are also deleted. I am using the new Az Module in powershell instead of the old Azure Module
The Remove-AzDeployment cmdlet is used to remove a deployment from the deployment history. It won't remove resources deployed in this particular deployment.
You can remove resources from the resource group using Remove-AzResource, like this:
Get-AzResource -ResourceGroupName $ResourceGroupName | Remove-AzResource -Force

Use Powershell with Azure to retrieve the ConnectionString of an AuthoriztionRule of a Service Bus Topic

I'm a bit of an Azure & Powershell newbie.
I'm trying to write PowerShell scripts to create an environment that can be published to from Azure DevOps.
As part of that, I'm creating a Service Bus with multiple topics. Each of the topics will have multiple Authorization Rules - one for publication and one for subscription.
I have the scripts for this working. However, I need to get the connection strings for these rules and save them to a key vault, to make them available to apps.
This is where I have become stuck.
This is similar to my existing code:
New-AzServiceBusTopic -ResourceGroupName myResourceGroup -Namespace myServiceBus -EnablePartitioning $false -Name myTopic
New-AzServiceBusAuthorizationRule `
-ResourceGroupName myResourceGroup `
-Namespace myServiceBus `
-Topic myTopic`
-Name myTopic.pub `
-Rights #("Send")
In the Azure Portal, I would click into the Service bus and Topic, select Shared Access Policies and click on the policy. It would show me the SAS Policy with the Primary Connection String.
Is there any way in PowerShell to get the Primary Connection String?
Thanks
If you have azure powershell Az.ServiceBus module installed, you can directly use this command: Get-AzServiceBusKey.
For example:
Get-AzServiceBusKey -ResourceGroup Default-ServiceBus-WestUS -Namespace SB-Example1 -Name AuthoRule1

Azure DevOps Variable Group not applying in Azure Function Configuration

I am trying to leverage the Variable Group functionality in Azure DevOps.
I have created the variable group within the Release pipeline and I have associated. However, when I release the code to the Function App in Azure; when I go to the Configuration settings in the Function app, the custom settings are not there.
Is there a step I am missing here on getting these to show up?
UPDATE: To fix this; I needed to write the variables. This is the step I did it.
I usually do this using a powershell task after publishing the new code. So add a new powershell task and define it as inline:
$appname = "name of your function app"
$rg = "name of resource group"
$webApp = Get-AzureRmwebApp -ResourceGroupName $rg -Name $appname
$webAppSettings = $webApp.SiteConfig.AppSettings
$hash = #{}
foreach ($setting in $webAppSettings) {
$hash[$setting.Name] = $setting.Value
}
$hash['New name'] = $("pipelineVariable")
Set-AzureRMWebAppSlot -ResourceGroupName $rg -Name $appname -AppSettings $hash -Slot production
PS: define the deployment slot as a variable too

IS there a way to Extract function app name from arm template file of CI Build during deplopyment to azure (CD) process

In azure devops CI pipelines i am deploying arm template for resource creation .In the release process how do i extract the resources created names from artifact so that i can refer to correct resource for deployment on azure
You could leverage the outputs section of an ARM template for this.
These values are recorded in the deployment created which you could fetch, either using the Get-AzResourceGroupDeployment cmdlet or az group deployment show command as documented in this section.
Assuming that you use New-AzureRmResourceGroupDeployment cmdlet here is what I do to get the json output.
$jsonOutput = New-AzureRmResourceGroupDeployment -Name $DeploymentName `
-ResourceGroupName $ResourceGroupName `
-TemplateFile $TemplateFileToDeploy `
-TemplateParameterObject $TemplateParameters `
-Force -Verbose `
-ErrorVariable ErrorMessages -DeploymentDebugLogLevel
Thereafter, I use either the $jsonOuput.Outputs which contain template outputs or the $jsonOutput.Parameters which in my case contains the resource names and other stuff.

Resources