@ResourceGroupPreparer(location='brazilsouth')
@StorageAccountPreparer(name_prefix='clitestacrdeploy')
def test_acr_deployment_function_app(self, resource_group, storage_account):
    plan = self.create_random_name(prefix='acrtestplanfunction', length=24)
    functionapp = self.create_random_name(prefix='functionappacrtest', length=24)
    runtime = 'node'
    acr_registry_name = functionapp
    self.cmd('acr create --admin-enabled -g {} -n {} --sku Basic'.format(resource_group, acr_registry_name))
    self.cmd('appservice plan create -g {} -n {} --sku S1 --is-linux'.format(resource_group, plan))
    self.cmd('functionapp create -g {} -n {} -s {} --plan {} --runtime {}'.format(resource_group, functionapp, storage_account, plan, runtime))
    creds = self.cmd('acr credential show -g {} -n {}'.format(resource_group, acr_registry_name)).get_output_in_json()
    self.cmd('functionapp config container set -g {0} -n {1} --docker-custom-image-name {2}.azurecr.io/image-name:latest --docker-registry-server-url https://{2}.azurecr.io'.format(resource_group, functionapp, acr_registry_name), checks=[JMESPathCheck("[?name=='DOCKER_REGISTRY_SERVER_USERNAME']|[0].value", creds['username'])])
    result = self.cmd('functionapp deployment container config -g {} -n {} --enable-cd true'.format(resource_group, functionapp)).get_output_in_json()
    self.assertTrue(result['CI_CD_URL'].startswith('https://'))
    self.assertTrue(result['CI_CD_URL'].endswith('.scm.azurewebsites.net/docker/hook'))
    show_result = self.cmd('functionapp deployment container show-cd-url -g {} -n {}'.format(resource_group, functionapp)).get_output_in_json()
    self.assertTrue(show_result['CI_CD_URL'].startswith('https://'))
    self.assertTrue(show_result['CI_CD_URL'].endswith('.scm.azurewebsites.net/docker/hook'))
    self.cmd('functionapp delete -g {} -n {}'.format(resource_group, functionapp))
@ResourceGroupPreparer(location='brazilsouth')
@StorageAccountPreparer(name_prefix='clitestacrdeploy')
def test_acr_deployment_function_app(self, resource_group, storage_account):
    plan = self.create_random_name(prefix='acrtestplanfunction', length=24)
    functionapp = self.create_random_name(prefix='functionappacrtest', length=24)
    runtime = 'node'
    acr_registry_name = functionapp
    self.cmd('acr create --admin-enabled -g {} -n {} --sku Basic'.format(resource_group, acr_registry_name))
    self.cmd('appservice plan create -g {} -n {} --sku S1 --is-linux'.format(resource_group, plan))
    self.cmd('functionapp create -g {} -n {} -s {} --plan {} --runtime {}'.format(resource_group, functionapp, storage_account, plan, runtime))
    creds = self.cmd('acr credential show -g {} -n {}'.format(resource_group, acr_registry_name)).get_output_in_json()
    self.cmd('functionapp config container set -g {0} -n {1} --docker-custom-image-name {2}.azurecr.io/image-name:latest --docker-registry-server-url https://{2}.azurecr.io'.format(resource_group, functionapp, acr_registry_name), checks=[JMESPathCheck("[?name=='DOCKER_REGISTRY_SERVER_USERNAME']|[0].value", creds['username'])])
    result = self.cmd('functionapp deployment container config -g {} -n {} --enable-cd true'.format(resource_group, functionapp)).get_output_in_json()
    self.assertTrue(result['CI_CD_URL'].startswith('https://'))
    self.assertTrue(result['CI_CD_URL'].endswith('.scm.azurewebsites.net/docker/hook'))
    show_result = self.cmd('functionapp deployment container show-cd-url -g {} -n {}'.format(resource_group, functionapp)).get_output_in_json()
    self.assertTrue(show_result['CI_CD_URL'].startswith('https://'))
    self.assertTrue(show_result['CI_CD_URL'].endswith('.scm.azurewebsites.net/docker/hook'))
    self.cmd('functionapp delete -g {} -n {}'.format(resource_group, functionapp))