0
votes

I have a fresh publishsettings file obtained with use of command Get-AzurePublishSettingsFile

And when I run following command:

Import-AzurePublishSettingsFile -SubscriptionDataFile "path to publishsettings"

I'm getting this error:

    Import-AzurePublishSettingsFile : Error in line 1 position 14. Expecting element 'ProfileData' from namespace 'http://schemas.datacontract.org/2004/07/Microsoft.WindowsAzure.Comman
ds.Utilities.Common'.. Encountered 'Element'  with name 'PublishData', namespace ''. 
At line:1 char:1
+ Import-AzurePublishSettingsFile -SubscriptionDataFile "path to publishsettings ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Import-AzurePublishSettingsFile], SerializationException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.ImportAzurePublishSettingsCommand

Looks like powershell cmdlet expects to see a file with different structure, but I have no idea where I can get one.

Am I doing something wrong here or it's an issue with Azure Powershell?

Azure module version is 0.8.2

3

3 Answers

1
votes

I don't have an answer to your specific question. But I may have a better option, and something you can try to resolve the original issue.

See ArgumentNullException - Get-AzureService.

That post describes the following two options:

Instead of using publish settings files for management API authentication you can use your normal management portal login credentials. This is generally a better option for using the Azure powershell cmdlets.

If that doesn't work for you then see the link above for how to clear out the cached subscription configuration files and see if that fixes the Import-AzurePublishSettingsFile issue you are seeing.

0
votes

I ran into the same issue. It turned out that I had used the incorrect parameter switch to specify the settings file.

Double check that you are using -PublishSettingsFile argument and not -SubscriptionDataFile as shown in your examples.

See the excerpt from powershell help below, for an explanation of each parameter.

Parameters
-PublishSettingsFile <String>
   Specifies the full path and filename for the .publishsettings file for the Windows Azure account.  

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-SubscriptionDataFile <String>
    Specifies the path to a file where the subscription data is stored. This parameter is optional. If it is not provided, the subscription data is imported into a default file in the user's profile.  

    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false
0
votes

I was able to make this work after several tries.

You need to start PowerShell as Administrator and clearly layout the path to the filename assigned the downloaded file to.

Once I did this it worked well.