CiscoDevNet / intersight-powershell

Cisco Intersight PowerShell
Apache License 2.0
16 stars 4 forks source link

Set-IntersightConfiguration broken in 1.0.11.13236 #106

Closed wgjhstt247 closed 7 months ago

wgjhstt247 commented 1 year ago

Describe the bug Error: Set-IntersightConfiguration: Error performing this operation. Check that BasePath and API Key identifier are configured correctly using the Set-IntersightConfiguration cmdlet.

To Reproduce Follow the steps provided in README to use Set-IntersightConfiguration

Import-Module Intersight.Powershell -RequiredVersion 1.0.11.13236
$config = @{
...fill out parameters here as expected...
}
Set-IntersightConfiguration @config

Version used

Expected behavior Successful response as in Module version 1.0.11.12738

Additional context The same configuration works fine in module version 1.0.11.12738

Ghufz commented 1 year ago

I am not able to reproduce this issue, Can you provide us the exact error screenshot. Here is the same cmdlet I have run it.

Get-Module -Name Intersight.PowerShell | fl

Name              : Intersight.PowerShell
Path              : C:\1.0.11-12236\Intersight\Intersight.PowerShell.dll
Description       : Intersight Powershell module provides the cmdlets to manage, analyze, and automate the IT infrastructure in Intersight.
ModuleType        : Binary
Version           : 1.0.11.13236
PreRelease        :
NestedModules     : {}
ExportedFunctions :
ExportedCmdlets   : {Get-IntersightAaaAuditRecord, Get-IntersightAaaRetentionConfig, Get-IntersightAaaRetentionPolicy, Get-IntersightAccessIpAddress…}
ExportedVariables :
ExportedAliases   :

Configure the required parameters

$basePath = "https://us-east-1.intersight.com"
$ApiKeyId = "5cd4exxxxxxxxxxx/5ef9bd0e7564612d328ebd60/64a3e20b756461xxxxxxxxxxxxxx"
$ApiKeyFilePath = "C:\\Users\\SecretKey.txt"

 $config = @{
BasePath = $basePath
ApiKeyId = $ApiKeyId
ApiKeyFilePath = $ApiKeyFilePath
HttpSigningHeader =  @("(request-target)", "Host", "Date", "Digest")
}
Set-IntersightConfiguration @config
wgjhstt247 commented 1 year ago

For security reasons, I've crossed out sensitive information, but here's what I'm doing. I'm using a CVA appliance deployed locally. image image image

Ghufz commented 1 year ago

Can you check the error message once you get the exception by using the below variable

$Error[0].Exception
wgjhstt247 commented 1 year ago

image

![image](https://github.com/CiscoDevNet/intersight-powershell/assets/802507/6f3397a0-4af2-46d3-9a58-c350ab94d5a1)
Ghufz commented 1 year ago

It seems the old RestSgarp.dll is being used in you powershell session. Can you run the follwoing cmdlet to check the issue is common for all cmdlets.

# once you run Set-IntersightConfiguration please execute below cmdlet and check whether it works or same exception has been thrown like before.

Get-IntersightConfiguration # to check the Intersight Configuration.

Get-IntersightNtpPolicy

Get-IntersightManagedObject -ObjectType organization.Organization
wgjhstt247 commented 1 year ago
Ghufz commented 1 year ago

It seems the exception is caused due to the object received from the server, Can you check the Get-IntersightOrganizationOrganization here also you may encounter the same error multiple schema matched.

Please check the data on server side that any Mo has missing objectType or ClassId value or any enum type property has the value which is not supported now.

wgjhstt247 commented 1 year ago

The same server side data returned by Get-IntersightOrganizationOrganization works fine with the previous version of the powershell module. That said, I noticed that 'VersionContext' and 'DisplayNames' are not present on the objects returned from the Server with default parameters.

There are no MoId, objectType, or ClassId properties values missing.

Ghufz commented 1 year ago

@wgjhstt247 Did you tried with the latest Intersight.PowerShell module?

wgjhstt247 commented 1 year ago

In version 1.0.11.13376 - Yes, same result.

wgjhstt247 commented 1 year ago

@Ghufz This is still broken. Please fix this.

Ghufz commented 7 months ago

Please follow the workaround suggested by https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/resolving-dependency-conflicts?view=powershell-7.4#use-the-dependency-out-of-process

Refer to Section Use the dependency out of process