What is the difference between ServiceFabricClusterConfiguration and ServiceFabricClusterManifest? - azure-service-fabric

My question regards updating the configuration for a Service Fabric standalone Windows cluster.
What is the difference between ServiceFabricClusterConfiguration and ServiceFabricClusterManifest?
Suppose that I want to change the ApplicationPorts setting, I see these options:
Using ServiceFabricClusterConfiguration
use Get-ServiceFabricClusterConfiguration
edit the JSON file
Start an upgrade using Start-ServiceFabricClusterConfigurationUpgrade
or
Using ServiceFabricClusterManifest
Use Get-ServiceFabricClusterManifest
edit the XML file
Start an upgrade using
Register-ServiceFabricClusterPackage -Config -ClusterManifestPath "ClusterConfigv2.xml"
Start-ServiceFabricClusterUpgrade -ClusterManifestVersion 2 -Config
I tried to change ApplicationPorts via the ServiceFabricClusterManifest. We are now in a situation that the ApplicationPorts is different in the json (Get-ServiceFabricClusterConfiguration) than the value in the XML (Get-ServiceFabricClusterManifest)
My questions are:
What is the difference between the two approaches?
What is the approach I should take?
Since the different Get- commands give different results, which is the way to see the actual applied configuration?
update:
I get the following error when I run the Start-ServiceFabricClusterConfigurationUpgrade command.
Exception : System.Exception: Exception of type 'System.Exception' was thrown.
at System.Fabric.Interop.NativeClient.IFabricClusterManagementClient7.EndUpgradeConfiguration(IFabricAsyncOperationC
ontext context)
at System.Fabric.Interop.Utility.<>c__DisplayClassa.<WrapNativeAsyncInvoke>b__9(IFabricAsyncOperationContext context
)
at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedComplet
edSynchronously)
TargetObject : Microsoft.ServiceFabric.Powershell.ClusterConnection
CategoryInfo : NotSpecified: (Microsoft.Servi...usterConnection:ClusterConnection) [Start-ServiceFa...gurationUpgrade], Exception
FullyQualifiedErrorId : StartClusterConfigurationUpgradeErrorId,Microsoft.ServiceFabric.Powershell.StartClusterConfigurationUpgrade
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails :

For on premises deployments Start-ServiceFabricClusterConfigurationUpgrade is the supported mechanism and is the only one you should use. As long as you use only one mechanism you shouldn't receive inconsistent results.

The detailed error is in the trace logs. Could u provide the 2 JSON files? Also, a common error is to upgrade without updating the json config version, which is the "clusterConfigurationVersion" item on the JSON config.

Related

"Invalid namespace" Error when trying to use NetQosPolicy in Powershell

Trying to limit the network bandwidth for a certain application, I came across such a thing as NetQosPolicy. I started trying to create new policies through PowerShell, but kept getting this error:
New-NetQosPolicy : New-NetQosPolicy : Invalid namespace string:1 character:1 + New-NetQosPolicy -Name TestPolicy -IPProtocolMatchCondition Both -Net ... + + CategoryInfo : MetadataError: (MSFT_NetQosPolicySettingData:ROOT/StandardCi...licySettingData) [New-Net QosPolicy], CimException + FullyQualifiedErrorId : HRESULT 0x8004100e,New-NetQosPolicy
I used this code: New-NetQosPolicy -Name TestPolicy -IPProtocolMatchCondition Both -NetworkProfile All -ThrottleRateActionBitsPerSecond 1200000
I thought I had made a mistake in the syntax and decided to look at the examples on the Microsoft website (https://learn.microsoft.com/en-us/powershell/module/netqos/new-netqospolicy?view=windowsserver2022-ps), but even their examples cause me the same error.
I haven't found a solution to this problem anywhere, so I'm asking on the forum. I will be grateful to anyone who knows how to solve this problem.
(By the way, I get the same error when I try to use the NetSecurity module (for example, the command: New-NetFirewallRule))
You might have a corrupt wmi repo, read this page but start with this check
Check if the repository is corrupted or not by running following command from command prompt with admin rights: winmgmt /verifyrepository

Powershell command for Create OSDisk and DataDisk snapshot

I am writing powershell script for capture OS-disk snapshot for Azure VM but While configuring snapshot I am getting some error.
I am using below command to create snapshot.I am using managed disk.
New-AzSnapshotConfig -OsType Linux -CreateOption copy -SourceUri Microsoft.Azure.Management.Compute.Models.OSDisk -DiskSizeGB 40 -Location 'East US'
Not sure how to do that. If anyone could you please help me to solve this issue.
OUTPUT
WARNING: Breaking changes in the cmdlet 'New-AzSnapshotConfig' :
WARNING: - "The output type 'Microsoft.Azure.Commands.Compute.Automation.Models.PSSnapshot' is changing"
- The following properties in the output type are being deprecated :
'EncryptionSettings'
- The following properties are being added to the output type :
'EncryptionSettingsCollection' 'HyperVGeneration'
WARNING: NOTE : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in
Azure PowerShell.
ResourceGroupName :
ManagedBy :
Sku :
TimeCreated :
OsType : Linux
HyperVGeneration :
CreationData : Microsoft.Azure.Management.Compute.Models.CreationData
DiskSizeGB : 40
EncryptionSettingsCollection :
ProvisioningState :
Id :
Name :
Type :
Location : East US
Tags :
EncryptionSettings :
Thanks
Rohit
Did you go to the link provided in the warning note? It says very clearly:
How do I get rid of the warnings?
To suppress these warning messages, set the environment variable 'SuppressAzurePowerShellBreakingChangeWarnings' to 'true'.
Set-Item Env:\SuppressAzurePowerShellBreakingChangeWarnings "true"
The error message is trying to tell you that the property EncryptionSettings you see in the output you provided will soon be changing from a single property of some type, to a collection property that you would have to iterate over to find all of the settings. They are trying to let you know that if you are capturing the output of New-AzSnapshotConfig to a variable and then calling $variable.EncryptionSettings, your code will work for now, but in the next breaking change release, that call will stop working. Most likely, since that property will no longer exist, the result of that call will simply be a $NULL.
So suppress this warning at your own risk because Microsoft is trying to do you a service here and let you know that if you don't do something about this your code could break. But if you are certain that you never reference property then you have nothing to worry about.

Ansible through WinRM: win_find throws OutOfMemoryException

I'm working on some Ansible playbooks that have to run on Windows Server 2008 with Powershell 3.
As part of one of these playbooks I do a win_find to get a list of files in a directory:
- name: filecheck
win_find:
paths: C:\dev\envs
register: envs
When I try to run the playbook, it runs correctly through preliminary operations (eg printing some debug variables) but then errors out when the above operation is executed:
"module_stderr": "Exception of type 'System.OutOfMemoryException' was thrown.\r\nAt line:60 char:9\r\n+ If (-not $obj.GetType)\r\n+ ~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : OperationStopped: (:) [], OutOfMemoryException\r\n + FullyQualifiedErrorId : System.OutOfMemoryException\r\n \r\n\r\n",
Now I don't see a scenario where a non-recursive find on a folder with three files would be able to consume 150MB of memory, let alone the 2048 that's been allocated to shells over WinRM.
Does anyone know how I can fix this issue or try and find the root cause?

How can I fix this "Set-SecureBootUEFI : Incorrect authentication data: 0xC0000022" error?

I used the tutorial and the PowerShell scripts in UefiSecureBootManualTests.zip(EnableSecureBoot.ps1 and append_LostCA_db.ps1) found here to sign an .efi file and enable SecureBoot to see if the system boots(it all worked well).
Now I'm trying to take the winload file from system32, sign it using the same scripts, and then overwrite the keys and see if SecureBoot lets me boot only with the winload I signed.
This time I am using the same scripts, except I modified Set-SecureBootUEFI command in the append_LostCA_db.ps1 deleting -AppendWrite parameter so it can overwrite.
But now I am receiving an error:
Set-SecureBootUEFI : Incorrect authentication data: 0xC0000022
At F:\SecureBoot\AllowNewCertificate\suprascriu_LostCA_db.ps1:13 char:5
+ Set-SecureBootUEFI -Name db -Time 2011-05-21T13:30:00z -ContentFilePath Lost ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (Microsoft.Secur...BootUefiCommand:SetSecureBootUefiCommand) [Set-Secu
reBootUEFI], UnauthorizedAccessException
+ FullyQualifiedErrorId : SetFWVarFailed,Microsoft.SecureBoot.Commands.SetSecureBootUefiCommand
How can I fix this?
I am using a HP desktop with Win8.1 x64
LATER EDIT: It would REALLY help if someone could give me an unsinged winload for 8.1 x64
One of the things that these signatures tell you is that the content has not been modified(that means it is still secure/valid/trustable). So that is the reason why I could not sign a file already signed(the loader used at boot and signed by Microsoft). That's why I was getting the UnauthorizedAccessException.
There is no workaround for this.

Windows AppFabric - renamed server, config now not loading

My original server was called xyz and the config was as follows:
\xyz\AppFabricConfig\ClusterConfig.xml
We renamed the server and it is now called 123, but the config is still pointing to
\xyz\AppFabricConfig\ClusterConfig.xml
And giving the following error when trying to load:
Use-CacheCluster : ErrorCode<ERRCMS0001>:SubStatus<ES0001>:Error while trying t
o load configuration: An error occurred loading a configuration file: Logon fai
lure: unknown user name or bad password.
(\\xyz\AppFabricConfig\ClusterConfig.xml)
At line:1 char:62
+ Import-Module DistributedCacheAdministration;Use-CacheCluster <<<<
+ CategoryInfo : NotSpecified: (:) [Use-CacheCluster], DataCacheE
xception
+ FullyQualifiedErrorId : ERRCMS0001,Microsoft.ApplicationServer.Caching.C
ommands.UseCacheClusterCommand
I've manually edited the following file:
C:\Windows\System32\AppFabric\DistributedCacheService.exe.config
And set: configuration/dataCacheConfig/clusterConfig connectionString="\123\AppFabricConfig\ClusterConfig.xml"
But its still trying to load from:
\xyz\AppFabricConfig\ClusterConfig.xml
Stumped - close to re-installing, but would really prefer not too!
In hind sight, best way to handle this would've been unconfigure the hosts with remove-cachehost and remove-cacheadmin, rename server and then run config wizard or run add-cachehost and add-cacheadmin.
The connection string is also present in registry, change there also: local machine\software\microsoft\appfabric\v1.0\configuration: connectionstring.
[Edit]
To remove/add the host from cluster configuration, Register-cachehost and unregister-cachehost also need to be run.