Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registering Entra ID to support PowerShell Script for TEOC #251

Open
3666228 opened this issue Sep 23, 2024 · 6 comments
Open

Registering Entra ID to support PowerShell Script for TEOC #251

3666228 opened this issue Sep 23, 2024 · 6 comments

Comments

@3666228
Copy link

3666228 commented Sep 23, 2024

I am stuck at the point of setting up my Entra ID - Step 13. Request API permissions and selecting 'SharePoint'. The option is not available to me. Hoping once this is complete my script will run without error due to the 9/9/24 update.

@v-ajaysahu
Copy link
Collaborator

@3666228 , Thank you for bringing this issue to our attention.
Could you let us know if you were successful in registering the Entra App ID as outlined in the wiki? Additionally, it would be helpful if you could specify the exact step where you encountered difficulties, especially since the wiki does not list a Step 13.

@3666228
Copy link
Author

3666228 commented Sep 25, 2024

Here is the wiki link I was directed to from PowerShell when I get the 'After September 9th Error'. This is where I am referencing the step 13 aspect. https://pnp.github.io/powershell/articles/registerapplication.html

@v-ajaysahu
Copy link
Collaborator

v-ajaysahu commented Sep 25, 2024

@3666228 ,
Currently, you're using a manual method. Could you switch to the automatic process? It automatically generates an Entra ID and assigns the appropriate permissions.

https://pnp.github.io/powershell/articles/registerapplication.html#automatically-create-an-app-registration-for-interactive-login

@3666228
Copy link
Author

3666228 commented Sep 26, 2024

Now, I am getting the following error.

1

@3666228
Copy link
Author

3666228 commented Sep 26, 2024

Mind you I changed the psi script to the following.

param([string]$AdminEmail,
[string]$TenantName)

$FilePath = Read-Host "Enter site template XML schema file path";
$FilePath = $FilePath.Trim();

Write-Host $FilePath

$TenantName = Read-Host "Enter tenant name: (contoso)";
$TenantName = $TenantName.Trim();

$AdminEmail = Read-Host "Enter tenant admin email";
$AdminEmail = $AdminEmail.Trim();

$SiteName = Read-Host "Enter site name. Allowed characters for site name are underscore, dashes, single quotes, and periods (_,-,',.), and can't start or end with a period.";
$SiteName = $SiteName.Trim();

$SiteURL = $SiteName -replace " ", ""

$TenantURL = "https://$TenantName.sharepoint.us"
$EOCSiteURL = "/sites/$SiteURL"

Connect-PnPOnline -Url $TenantURL -Interactive -ClientID cc806dec-028f-4a10-a12d-5ae6b186c893

try {
Write-Host "Checking if site already exists at $EOCSiteURL"
$site = Get-PnPTenantSite -Url $TenantURL$EOCSiteURL -ErrorAction SilentlyContinue

if ($null -ne $site) {
    Write-Host "Site already exists, exiting the PowerShell script"
    return;
}
else {
    Write-Host "Site doesn't exist, creating new site at $EOCSiteURL"
}

try {
    if (($TenantURL + $EOCSiteURL).Length -lt 128) {
        New-PnPSite -Type TeamSiteWithoutMicrosoft365Group -Title $SiteName -Url $TenantURL$EOCSiteURL -Owner $AdminEmail -ErrorAction Stop -WarningAction SilentlyContinue
    }
    else {
        Write-Host "Site creation failed. Site URL cannot have more than 128 characters." -ErrorAction Stop
        return
    }
}
catch {
    Write-Host "`nError Message: " $_.Exception.Message
    Write-Host "Site creation failed. Site name cannot contain symbols other than underscore, dashes, single quotes, and periods (_,-,',.), and can't start or end with a period."
    return;

}

Connect-PnPOnline -Url $TenantURL$EOCSiteURL -Interactive 
Write-Host "Creating lists in $SiteName site"

Invoke-PnPSiteTemplate -Path $FilePath -ErrorAction Stop -WarningAction SilentlyContinue
      
Write-Host "App Provision complete."

}
catch {
Write-Host "nError Message: " $_.Exception.Message Write-Host "nApp Provisioning failed."
}

@v-ajaysahu
Copy link
Collaborator

@3666228 ,
We've updated our PowerShell script, and you can access it via the following link: https://github.com/OfficeDev/microsoft-teams-emergency-operations-center/tree/main/Deployment/provisioning.
Regarding the issues you're encountering, they are associated with PnP. You have the option to consult our wiki for deployment guidance or contact the PnP team for further assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants