pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
415 stars 642 forks source link

Apply-PnPProvisioningTemplate : The requested operation is part of an experimental feature that is not supported in the current environment. #1747

Closed Tran-Kien closed 6 years ago

Tran-Kien commented 6 years ago

Category

[ X ] Bug [ ] Enhancement

Environment

[ X ] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013

Expected or Desired Behavior

Apply the blank provisioning template without error.

Observed Behavior

A PowerShell error when running Apply-PnPProvisioningTemplate.

"Apply-PnPProvisioningTemplate : The requested operation is part of an experimental feature that is not supported in the current environment."

Steps to Reproduce

  1. Create a blank communication site (modern)
  2. Install the latest PnP PowerShell (2.26.1805.0)
  3. Connect to the newly created site using Connect-PnPOnline
  4. Run Get-PnPProvisioningTemplate -Out template.xml
  5. Run Apply-PnPProvisioningTemplate -Path .\template.xml

Get the error above.

Here is the template:

<?xml version="1.0"?>

![capture](https://user-images.githubusercontent.com/19476512/39782527-727fdf16-52e0-11e8-81b4-7c243b262ee2.PNG)
erwinvanhunen commented 6 years ago

Hi!

Unfortunately I'm not able to reproduce the issue you describe. Following the sequence of cmdlets you post in your screenshot succeeds for me without a problem.

I even took the template (some copy pasting errors I assume as some of the tags where missing) you posted and applied that succesfully to a site I just created.

Can you try to reproduce the error and then straight after that enter:

$error[0].Exception.Stacktrace

This will output the full stacktrace of where the error occured. Please post that stacktrace here so we can dive a bit deeper into what's going on on your end.

Regards,

/Erwin

Tran-Kien commented 6 years ago

image

Tran-Kien commented 6 years ago

Here is a screenshot of the entire template. capture

Tran-Kien commented 6 years ago

I would also like to bring to your attention that:

erwinvanhunen commented 6 years ago

Thank you for this. I think I see where it goes wrong when looking at the code. I'll work on a fix.

erwinvanhunen commented 6 years ago

Just for my confirmation: I assume you are not running the engine with an account that has tenant administration rights?

erwinvanhunen commented 6 years ago

A fix for this issue has been merged through PR #1752

Tran-Kien commented 6 years ago

Thanks for looking into this. Yes, my account happens to be tenant admin as well.

If it can help, I remove myself from being part of the users selected for Targeted Release in my tenant with the same outcome (after waiting an hour for the change to take effect). So I think it is not related to being Targeted Release.

erwinvanhunen commented 6 years ago

Interesting. Effectively was what was happening is that the engine would create a context towards the tenant administration site in order process any outstanding webapi approval requests. However, in your template where no such approvals defined. It nevertheless still builds a context towards the tenant admin site. And if you're not tenant admin, that's where it goes wrong. But in your case you are tenant admin, so that's puzzling.

asestromsrud commented 4 years ago

@erwinvanhunen You need to look into newer versions because the error has come back. We have had a lot of trouble with this function. Tried to get it work in Runbook in azure with several versions. Luckily I had an older version locally that worked and when I tested to load that in the Automation account it worked. The version I got to work is: 3.13.1909.0 The latest in Azure didn't work. Neither 3.19.2003.0.

JonvR commented 4 years ago

@erwinvanhunen So I also have this problem, at first I got a message about a push notification not being enabled, for which the fix is to enable a feature Enable-PnPFeature -Identity '41e1d4bf-b1a2-47f7-ab80-d5d6cbba3092' then I ran into this issue regarding the experimental problem. I'm running 3.24.2008.1 from an azure runbook. The fix for me was that it only affected the first statement and it will work for the other statements. I'm using the returnconnection on a site. I'm using an appID and secret to connect to the sites. But this works: Enable-PnPFeature -Identity '41e1d4bf-b1a2-47f7-ab80-d5d6cbba3092' -Connection $connectionSite Apply-PnPProvisioningTemplate -Connection $connectionSite

It will fail on the first statement, but succesfully implement the Apply statement. If I just do the apply statement it will fail. It doesn't matter what the first statement is as long as it does something with the site. So a get doesn't do it. So the workaround for me is to just do this with the first command Enable-PnPFeature -Identity '41e1d4bf-b1a2-47f7-ab80-d5d6cbba3092' -Connection $connectionSite -ErrorAction Ignore