Skip to content

Commit a897e9e

Browse files
Merge pull request #160 from microsoft/main
Fork Sync: Update from parent repository
2 parents 7c4c28c + af25752 commit a897e9e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/deployment/deploy.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def __init__(
160160
auto_create_cli_app: bool,
161161
host_dotnet_on_windows: bool,
162162
enable_profiler: bool,
163+
custom_domain: Optional[str],
163164
):
164165
self.subscription_id = subscription_id
165166
self.resource_group = resource_group
@@ -173,6 +174,7 @@ def __init__(
173174
self.third_party = third_party
174175
self.create_registration = create_registration
175176
self.multi_tenant_domain = multi_tenant_domain
177+
self.custom_domain = custom_domain
176178
self.upgrade = upgrade
177179
self.results: Dict = {
178180
"client_id": client_id,
@@ -636,6 +638,21 @@ def deploy_template(self) -> None:
636638
app_func_audiences = [self.get_identifier_url()]
637639
app_func_audiences.extend([self.get_instance_url()])
638640

641+
# Add --custom_domain value to Allowed token audiences setting
642+
if self.custom_domain:
643+
644+
if self.multi_tenant_domain:
645+
root_domain = self.multi_tenant_domain
646+
else:
647+
root_domain = "%s.azurewebsites.net" % self.application_name
648+
649+
custom_domains = [
650+
"api://%s/%s" % (root_domain, self.custom_domain.split(".")[0]),
651+
"https://%s/%s" % (root_domain, self.custom_domain.split(".")[0]),
652+
]
653+
654+
app_func_audiences.extend(custom_domains)
655+
639656
if self.multi_tenant_domain:
640657
# clear the value in the Issuer Url field:
641658
# https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient-enterpriseapi-multitenant
@@ -1302,6 +1319,13 @@ def main() -> None:
13021319
action="store_true",
13031320
help="Enable CPU and memory profiler in dotnet Azure Function",
13041321
)
1322+
1323+
parser.add_argument(
1324+
"--custom_domain",
1325+
type=str,
1326+
help="Use a custom domain name for your Azure Function and CLI endpoint",
1327+
)
1328+
13051329
args = parser.parse_args()
13061330

13071331
if shutil.which("func") is None:
@@ -1334,6 +1358,7 @@ def main() -> None:
13341358
auto_create_cli_app=args.auto_create_cli_app,
13351359
host_dotnet_on_windows=args.host_dotnet_on_windows,
13361360
enable_profiler=args.enable_profiler,
1361+
custom_domain=args.custom_domain,
13371362
)
13381363
if args.verbose:
13391364
level = logging.DEBUG

0 commit comments

Comments
 (0)