xabikos
xabikos

Reputation: 195

Error when updating a PowerBI workspace collection from an arm template

We have deployed a PowerBI embedded workspace collection with the following really simple arm template

{
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {},
  "variables": {},
  "resources": [
    {
      "comments": "Test Power BI  workspace collection",
      "apiVersion": "2016-01-29",
      "type": "Microsoft.PowerBI/workspaceCollections",
      "location": "westeurope",
      "sku": {
        "name": "S1",
        "tier": "Standard"
      },
      "name": "myTestPowerBiCollection",
      "tags": {
        "displayNmae": "Test Power BI workspace collection"
      }
    }
  ],
  "outputs": {}
}

For deployment we used the well known Powershell command New-AzureRmResourceGroupDeployment After the creation if we try to execute the command again it fails with the following message

New-AzureRmResourceGroupDeployment : Resource  Microsoft.PowerBI/workspaceCollections 'myTestPowerBiCollection' failed with message
{
   "error": {
     "code": "BadRequest",
     "message": ""
   }
}

If we delete the collection and execute again succeeds without a problem. I tried with both the options for the -Mode parameter (Incremental, Complete) and didn't help, even though Incremental is the default option.

This is a major issue for us as we want to provision the collection as part of our Continuous Delivery and we execute this several times.

Any ideas on how to bypass this problem?

Upvotes: 3

Views: 301

Answers (1)

Tom Sun
Tom Sun

Reputation: 24539

As you mentioned , if PowerBI Workspace Collection name is existed, it will throw expection when we try to deploy the PowerBI Workspace Collection again.

If it is possible to add customized logical code, we could use Get-AzureRmPowerBIWorkspaceCollection to check whether PowerBI Workspace Collection is existed. If it is existed, it will return PowershellBIworkspaceCollection object, or will throw not found exception.

We also could use Remove-AzureRmPowerBIWorkspaceCollection command to remove PowerBI Workspace Collection. If PowerBI workspace Connection is existed we could skip to deploy or delete and renew it according to our logic.

Upvotes: 1

Related Questions