Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.
Merged
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
25 changes: 25 additions & 0 deletions src/deployment/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def __init__(
auto_create_cli_app: bool,
host_dotnet_on_windows: bool,
enable_profiler: bool,
custom_domain: Optional[str],
):
self.subscription_id = subscription_id
self.resource_group = resource_group
Expand All @@ -173,6 +174,7 @@ def __init__(
self.third_party = third_party
self.create_registration = create_registration
self.multi_tenant_domain = multi_tenant_domain
self.custom_domain = custom_domain
self.upgrade = upgrade
self.results: Dict = {
"client_id": client_id,
Expand Down Expand Up @@ -636,6 +638,21 @@ def deploy_template(self) -> None:
app_func_audiences = [self.get_identifier_url()]
app_func_audiences.extend([self.get_instance_url()])

# Add --custom_domain value to Allowed token audiences setting
if self.custom_domain:

if self.multi_tenant_domain:
root_domain = self.multi_tenant_domain
else:
root_domain = "%s.azurewebsites.net" % self.application_name

custom_domains = [
"api://%s/%s" % (root_domain, self.custom_domain.split(".")[0]),
"https://%s/%s" % (root_domain, self.custom_domain.split(".")[0]),
]

app_func_audiences.extend(custom_domains)

if self.multi_tenant_domain:
# clear the value in the Issuer Url field:
# https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient-enterpriseapi-multitenant
Expand Down Expand Up @@ -1302,6 +1319,13 @@ def main() -> None:
action="store_true",
help="Enable CPU and memory profiler in dotnet Azure Function",
)

parser.add_argument(
"--custom_domain",
type=str,
help="Use a custom domain name for your Azure Function and CLI endpoint",
)

args = parser.parse_args()

if shutil.which("func") is None:
Expand Down Expand Up @@ -1334,6 +1358,7 @@ def main() -> None:
auto_create_cli_app=args.auto_create_cli_app,
host_dotnet_on_windows=args.host_dotnet_on_windows,
enable_profiler=args.enable_profiler,
custom_domain=args.custom_domain,
)
if args.verbose:
level = logging.DEBUG
Expand Down