3

How can I perform an Elevate Session State in Sitecore PowerShell ISE on XM Cloud running in local container?

On the Elevate Session State, I need to "Enter your credentials to validate access to Execute a script." it tries to use my xmcloud username but it gives an error message

Could not validate access using the provided credentials.

Or else how can I execute and create PowerShell scripts?

4 Answers 4

3

As a Solution to be able to run Sitecore PowerShell Script, e.t.c. Is change the elevationAction in the config to Allow or Confirm, then you don't need to enter a password.

Set the elevationAction can be done by setting the environment var SITECORE_SPE_ELEVATION in your docker-compose.yml the patch file \Include\v.Spe\s.Spe.config is using this environment var, $(env:SITECORE_SPE_ELEVATION)

Or patch it your self but be sure it is after the s.Spe.config, place in a zz_spe folder for example.

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
  <sitecore role:require="XMCloud">
    <powershell>
      <userAccountControl>
        <tokens><token name="Default"  elevationAction="Block"/>
              <token name="Console" expiration="00:05:00" elevationAction="Allow" patch:instead="*[@name='Console']"/>
              <token name="ISE" expiration="00:05:00" elevationAction="Allow" patch:instead="*[@name='ISE']"/>
              <token name="ItemSave" expiration="00:05:00" elevationAction="Allow" patch:instead="*[@name='ItemSave']"/>
            </tokens>
      </userAccountControl>
    </powershell>
  </sitecore>
</configuration>
3

The way to do this for local instances is:

  1. Add SITECORE_SPE_ELEVATION: "Allow" to your docker-compose.override.yml file:
services: 
  cm:
    environment:
      SITECORE_SPE_ELEVATION: "Allow"
  1. Run ./down.ps1 in your terminal

  2. Run ./up.ps1 in your terminal

1

The correct way to do this is to modify the environment variable SITECORE_SPE_ELEVATION and set it to Block, Confirm, or Allow according to this documentation:

https://doc.sitecore.com/xmc/en/developers/xm-cloud/environment-variables.html

0

I had a similar issue, and here's how I fixed it:

  1. Update the existing Sitecore XM Cloud variable SITECORE_SPE_ELEVATION to "Confirm". You can refer to the Sitecore documentation for more details.

Please note that after making this change, simply redeploying won't resolve the issue. You need to rebuild and redeploy the entire solution to make it work.

Here are some images for reference:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.