private validateScmCredentialsSlotName()

in src/handlers/parameterValidator.ts [201:221]


    private validateScmCredentialsSlotName(state: StateConstant): void {
        if (this._scmCredentials && this._scmCredentials.uri && this._appName && this._slot) {
            let urlName: string = this._appName;

            // If slot name is 'production', the url name should not contain 'production' in it
            if (this._slot.toLowerCase() !== ConfigurationConstant.ProductionSlotName) {
                urlName = `${this._appName}-${this._slot}`;
            }

            const lowercasedUri = this._scmCredentials.uri.toLowerCase()
            const lowercasedAppName = urlName.toLowerCase()
            if (lowercasedUri.indexOf(lowercasedAppName) === -1) {
                throw new ValidationError(
                    state, ConfigurationConstant.ParamInSlot,
                    `SCM credential does not match slot-name ${this._slot}. Please ensure the slot-name parameter has ` +
                    "correct casing and the publish-profile is acquired from your function app's slot rather than " +
                    "your main production site."
                );
            }
        }
    }