Been working on a pipeline that spins up Azure WebApp instances as needed for a development process. Trying to bind a custom cert to the instance using:

thumbprint=$(az webapp config ssl upload \
    --name stuartstestapp \
    --resource-group stuartstestapp  \
    --certificate-file ./stuartstestapp.pfx \
    --certificate-password '6ulY$KiD4@iEBQ3kG#8!nqz' \
    --query thumbprint \
    --output tsv)

And was getting back this error:

'NoneType' object has no attribute 'server_farm_id'
Traceback (most recent call last):
  File "/Users/stuart/lib/azure-cli/lib/python2.7/site-packages/knack/", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/Users/stuart/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/", line 343, in execute
  File "/Users/stuart/lib/azure-cli/lib/python2.7/site-packages/azure/cli/command_modules/appservice/", line 54, in _polish_bad_errors
    raise ex
AttributeError: 'NoneType' object has no attribute 'server_farm_id'

Which appears all over the shop in search results, but without many actual solutions.

In my case the issue was that the wrong one of my Azure subscriptions was selected, for once I wasn’t testing stuff in my default subscription. So adding a quick line to the start of my script:

az account set --subscription WebAppTest

fixed it right up.