Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 964
user2044374 Avatar asked May 27 '26 05:05

user2044374


1 Answers

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.

like image 53
jack.chen.job Avatar answered May 30 '26 05:05

jack.chen.job