Over time, a lot of SPO site collections have accumulated in my tenant. Therefore, I want to use Site Collection Feature called Site Policy to automatically close and delete sites after a defined period of time.
To do that, I headed over to ContentTypeHub and created a site policy that closes a site after 6 months of its creation date, and then deletes that site after 12 months of its closure date.
When I want to apply this policy using GUI, it works well. Also, when I try to apply it using PnP PowerShell, it works. However, it is only applied at one site per-time. As mentioned, I'm dealing with a large number of sites and want to apply this policy to either all of them, or to a 10, 20, 50 of them at a time.
I used the following PnP PowerShell script to apply it to apply the policy on, at the beginning, 2 sites only:
2 sites, that is their URLs, are stored in a .csv file called SiteCollections.csv. This is how it looks:
When I run the script from above, I don't get any errors. This is my output:
It seems that all works fine, but when I head over to the GUI to check it, policies are not applied:
Is there something that I'm missing? Any help, suggestion or tip is more than welcome!