Is it possible to deploy an App Service (WebApp) a...
# azure
f
Is it possible to deploy an App Service (WebApp) and get it's Publish Profile w/ Pulumi? I have the WebApp deploying just fine, but I'm not seeing that I can get the value of the Publishing Profile from the result. My goal is to set a Github Action Secret with the publishing profile value in my repo so my build scripts can subsequently use it for deployments. I'm not seeing it in the documentation.
f
@faint-tiger-16075 did you find a way to do this? I’m attempting to do the same, but can’t really fine a good way to do this.
For anyone stumbling upon this in the future, here is how I solved this:
Copy code
def create_publish_profile(publish_profile: ListWebAppPublishingCredentialsResult, app_url: str) -> str:
    publish_url = publish_profile.scm_uri.split("@")[-1] + ":443"
    user_name = publish_profile.publishing_user_name
    user_pwd = publish_profile.publishing_password
    destination_app_url = "https://" + app_url

    publish_profile_string = f"""<publishData>
    <publishProfile
        publishUrl="{publish_url}"
        userName="{user_name}"
        userPWD="{user_pwd}"
        destinationAppUrl="{destination_app_url}"
    >
    </publishProfile>
</publishData>"""

    return publish_profile_string

app_publish_credentials = web.list_web_app_publishing_credentials_output(
    name=app.name,
    resource_group_name=resource_group.name
)

gh.ActionsSecret("github-publish-profile",
    secret_name="AZURE_WEBAPP_PUBLISH_PROFILE",
    repository=config.get("repo-name"),
    plaintext_value=pulumi.Output.all(
        app_publish_credentials,
        app.default_host_name,
    ).apply(lambda args: create_publish_profile(*args))
)