user2044374
user2044374

Reputation: 307

Import-AzurePublishSettingsFile throws runtime exception

We are getting the following exception when Importing the AzurePublishSettingsFile:

PS C:\Users\xxx> Import-AzurePublishSettingsFile "C:\xyz\azure.publishsettings" Import-AzurePublishSettingsFile : Exception of type 'System.Exception' was thrown. At line:1 char:1 + Import-AzurePublishSettingsFile "C:\xyz\azure.publishsettings" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Import-AzurePublishSettingsFile], Exception + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Subscription.ImportAzurePublishSettingsCommand

Please let me know how to resolve this.

Upvotes: 3

Views: 2344

Answers (4)

Bhanuka Yd
Bhanuka Yd

Reputation: 665

I had the same problem and I removed the spaces in the filename and worked fine :D

Upvotes: 0

jack.chen.job
jack.chen.job

Reputation: 329

I had the same problem when I tried my first line for Azure:

PS C:\Windows\system32> Import-AzurePublishSettingsFile –PublishSettingsFile "C:\azure\1.publishsettings"
Import-AzurePublishSettingsFile : Exception of type 'System.Exception' was thrown.
At line:1 char:1
+ Import-AzurePublishSettingsFile –PublishSettingsFile "C:\ubuntu\azure\1.publishs ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Import-AzurePublishSettingsFile], Exception
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.ImportAzurePublishSettingsCommand

Turned out I had the wrong filename.

I think

"Import-AzurePublishSettingsFile : Exception of type 'System.Exception' was thrown. At line:1 char:1"

could means the cmdlet didn't find the setting file ( this is the case for me).

If I run

Import-AzurePublishSettingsFile –PublishSettingsFile "C:\notexist.publishsettings"

It shows the same error.

Have to say this is a very unclear error message.

Upvotes: 3

neo
neo

Reputation: 6281

Try to run the Power Shell as administrator, it resolved similar error for me

Upvotes: -1

Vidar Kongsli
Vidar Kongsli

Reputation: 836

I get the same problem if I load the Azure module into a 64 bit version of Powershell. If I stick with the 32 bit version, the problem disappears. Is it possible that is the problem on your end?

Upvotes: 0

Related Questions