{"action":"created","issue":{"url":"https://api.github.com/repos/OfficeDev/PnP-Partner-Pack/issues/85","labels_url":"https://api.github.com/repos/OfficeDev/PnP-Partner-Pack/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/OfficeDev/PnP-Partner-Pack/issues/85/comments","events_url":"https://api.github.com/repos/OfficeDev/PnP-Partner-Pack/issues/85/events","html_url":"https://github.com/OfficeDev/PnP-Partner-Pack/issues/85","id":128693663,"number":85,"title":"\"File Not Found\" when provisioning a site that has a composed look","user":{"login":"petecuttriss","id":4825764,"avatar_url":"https://avatars.githubusercontent.com/u/4825764?v=3","gravatar_id":"","url":"https://api.github.com/users/petecuttriss","html_url":"https://github.com/petecuttriss","followers_url":"https://api.github.com/users/petecuttriss/followers","following_url":"https://api.github.com/users/petecuttriss/following{/other_user}","gists_url":"https://api.github.com/users/petecuttriss/gists{/gist_id}","starred_url":"https://api.github.com/users/petecuttriss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petecuttriss/subscriptions","organizations_url":"https://api.github.com/users/petecuttriss/orgs","repos_url":"https://api.github.com/users/petecuttriss/repos","events_url":"https://api.github.com/users/petecuttriss/events{/privacy}","received_events_url":"https://api.github.com/users/petecuttriss/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-26T01:40:48Z","updated_at":"2016-01-26T03:48:45Z","closed_at":null,"body":"Hi, I've been testing the PnP Partner Pack provisioning process.   I've created a simply site collection template which simply provisions a team site with a custom logo and composed look.  The composed look only contains a ColorFile (I've attached the associated template).\r\n\r\nWhen I use the template to provision a new site collection, I receive a \"File Not Found\" error when the engine attempts to apply the template.   I've managed to debug the associated ScheduledJob and I've found that the issue occurs with the token replacement, in which the token {sitecollection} and {themecatalog} get replaced with an empty string.   When I traced it further I found that call to Web.Context.GetSiteCollectionContext (ThemeCatalogToken.cs) actually returned to the tenant admin site collection context (https://<mytenant>-admin.sharepoint.com)... rather than the context of the newly created site collection.   Because of this the {themecatalog} token simply came back as /_catalogs/theme... rather than /<sitecollection>/_catalogs/theme.   I'll try and debug it further to see why it's getting the tenant admin context.\r\n\r\n[template-minimal.txt](https://github.com/OfficeDev/PnP-Partner-Pack/files/104299/template-minimal.txt)\r\n"},"comment":{"url":"https://api.github.com/repos/OfficeDev/PnP-Partner-Pack/issues/comments/174804205","html_url":"https://github.com/OfficeDev/PnP-Partner-Pack/issues/85#issuecomment-174804205","issue_url":"https://api.github.com/repos/OfficeDev/PnP-Partner-Pack/issues/85","id":174804205,"user":{"login":"petecuttriss","id":4825764,"avatar_url":"https://avatars.githubusercontent.com/u/4825764?v=3","gravatar_id":"","url":"https://api.github.com/users/petecuttriss","html_url":"https://github.com/petecuttriss","followers_url":"https://api.github.com/users/petecuttriss/followers","following_url":"https://api.github.com/users/petecuttriss/following{/other_user}","gists_url":"https://api.github.com/users/petecuttriss/gists{/gist_id}","starred_url":"https://api.github.com/users/petecuttriss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petecuttriss/subscriptions","organizations_url":"https://api.github.com/users/petecuttriss/orgs","repos_url":"https://api.github.com/users/petecuttriss/repos","events_url":"https://api.github.com/users/petecuttriss/events{/privacy}","received_events_url":"https://api.github.com/users/petecuttriss/received_events","type":"User","site_admin":false},"created_at":"2016-01-26T03:48:45Z","updated_at":"2016-01-26T03:48:45Z","body":"Further to this, the problem seems to be in the SiteCollectionProvisioningJobHandler.cs.   For some reason the adminContext (line 36) which wraps the call to web.ApplyProvisioningTemplate, then in turn passes through the tenant admin context.   I've tried moving the repositoryContext using statement out of the adminContext using statement, and then adding a separate call to GetAppOnlyClientContent prior to the web.ApplyProvisioningTemplate and it now works correctly and the tokens are correctly replaced by the core framework.   Attached is my updated SiteCollectionProvisioningJobHandler.cs version from the Infrastructure project. \r\n[SiteCollectionProvisioningJobHandler.txt](https://github.com/OfficeDev/PnP-Partner-Pack/files/104412/SiteCollectionProvisioningJobHandler.txt)\r\n\r\n"}}