IronWilliamCash
IronWilliamCash

Reputation: 539

Powershell importing Azure publish settings Invalid XML

I downloaded the "*.publishsettings" file from the Azure portal, but when executing the following command:

Import-AzurePublishSettingsFile - PublishSettingsFile ".\filename.publishsettings"

I get the following error all the time:

Import-AzurePublishSettingsFile : There is an error in XML document (1, 2). At E:\GIT\Taxprep Dashboard\web-application-ng\scripts\Azure-Publish.ps1:10 char:1 + Import-AzurePublishSettingsFile -PublishSettingsFile ".\filename.pushl ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Import-AzurePublishSettingsFile], InvalidOperationException + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.ImportAzurePublishSettingsCommand

Note: At the time of writing this question, I have already found the solution, but am still writing it up as I did not find anything on to fix this on StackOverflow, so I will answer it below.

Upvotes: 1

Views: 339

Answers (1)

IronWilliamCash
IronWilliamCash

Reputation: 539

The error comes from the fact that the "filename.publishsettings" file is one that was downloaded from a contributor account. To have a correct publishsettings file, you have to obtain it through and administrator or co-administrator account.

To see if the account has the correct rights, you can execute the following in PowerShell once you have the Azure commandlet installed:

get-azurePublishSettingsFile

This will then ask you for your credentials, which you can enter. The file will be downloaded automatically if you have appropriate rights. If not an error page will appear that says that you do not have the Administrator or Co-Administrator rights.

Unfortunately when you get the publishprofile directly from the portal, you are not advised that you will not be able to load the XML file.

Upvotes: 3

Related Questions