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

Using TenantID rather then default domain #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ bin
obj
appsettings.json
local.settings.json
scratch.ps1
Test-ProcessTenant/*

# Azurite artifacts
__blobstorage__
Expand Down
18 changes: 9 additions & 9 deletions Exec-HuduM365ProcessTenant/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ $EnableCIPP = [System.Convert]::ToBoolean($env:EnableCIPP)
$CIPPURL = $env:CIPPURL

try {
$hududomain = Get-HuduWebsites -name "https://$defaultdomain" -ea stop
$domaincount = ($hududomain.id | measure-object).count
$huduAPIAsset = Get-HuduAssets -Name $Customer.customerId -ea stop

if ($domaincount -eq 1) {
if ($null -ne $huduAPIAsset){
$TenantFilter = $Customer.CustomerId

$company_name = $hududomain[0].company_name
$company_id = $hududomain[0].company_id
$company_name = $huduAPIAsset.company_name
$company_id = $huduAPIAsset.company_id

$ExchangeAuthenticated = $true

try {
Expand Down Expand Up @@ -930,11 +930,11 @@ try {
} catch {
$CompanyResult.Errors.add("Company: Failed to import domain: $_")
}

} elseif ($domaincount -eq 0) {
$CompanyResult.Errors.add("Company: Domain not found in Hudu please add $defaultdomain to a company")
} elseif ($null -eq $huduAPIAsset) {
$CompanyResult.Errors.add("Company: API Asset not found in Hudu please add $($Customer.customerId) to a company")
} else {
$CompanyResult.Errors.add("Company: Multiple companies matched in Hudu for $defaultdomain")
$CompanyResult.Errors.add("Company: Multiple companies matched in Hudu for $($Customer.customerId)")
}
} catch {
$CompanyResult.Errors.add("Company: A fatal error occured: $_")
Expand Down