mention-bot: @brendandburns, thanks for your PR! By analyzing the history of the files in this pull request, we identified @yugangw-msft, @tjprescott and @derekbekoe to be potential reviewers.
tjprescott: @brendandburns this issue applies more generally to the CLI. See issue #1419. I think it can fixed more generally by making a change here: https://github.com/Azure/azure-cli/blob/master/src/azure-cli-core/azure/cli/core/application.py#L200

In addition to startswith('@') we can probably have something like `or '=@' in ...`. 
derekbekoe: Can we not make use of this?
https://docs.python.org/3/library/argparse.html#fromfile-prefix-chars

cc @tjprescott @johanste
brendandburns: @tjprescott thanks for the tip, I moved the code to that location (and I added unit tests too as a bonus!)

please take another look.

Thanks!
--brendan
tjprescott: @derekbekoe 

>  then arguments that start with any of the specified characters will be treated as files, and will be replaced by the arguments they contain

This problem is that with `foo=@bar`, the @ is in the middle of the string. 
brendandburns: @tjprescott fixed (and added tests to cover it) please take another look.

Thanks
--brendan
diff --git a/src/azure-cli-core/azure/cli/core/application.py b/src/azure-cli-core/azure/cli/core/application.py
index 0bc115f74..caab463a1 100644
--- a/src/azure-cli-core/azure/cli/core/application.py
+++ b/src/azure-cli-core/azure/cli/core/application.py
@@ -6,6 +6,7 @@
 from collections import defaultdict
 import sys
 import os
+import re
 import uuid
 import argparse
 from azure.cli.core.parser import AzCliCommandParser, enable_autocomplete
@@ -196,10 +197,24 @@ class Application(object):
         global_group.add_argument('--debug', dest='_log_verbosity_debug', action='store_true',
                                   help='Increase logging verbosity to show all debug logs.')
 
+    @staticmethod
+    def _maybe_load_file(arg):
+        ix = arg.find('@')
+        if ix == -1:
+            return arg
+
+        if ix == 0:
+            return Application._load_file(arg[1:])
+
+        res = re.match('(\\-\\-?[a-zA-Z0-9]+[\\-a-zA-Z0-9]*\\=)\\"?@([^\\"]*)\\"?', arg)
+        if not res:
+            return arg
+        return res.group(1) + Application._load_file(res.group(2))
+
     @staticmethod
     def _expand_file_prefixed_files(argv):
         return list(
-            [Application._load_file(arg[1:]) if arg.startswith('@') else arg for arg in argv]
+            [Application._maybe_load_file(arg) for arg in argv]
             )
 
     @staticmethod
diff --git a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py
index 6a50031c7..2d3464686 100644
--- a/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py
+++ b/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py
@@ -53,7 +53,7 @@ register_cli_argument('appservice plan', 'admin_site_name', help='The name of th
 register_cli_argument('appservice web', 'slot', help="the name of the slot. Default to the productions slot if not specified")
 register_cli_argument('appservice web', 'name', arg_type=name_arg_type, completer=get_resource_name_completion_list('Microsoft.Web/sites'), id_part='name', help='name of the web')
 register_cli_argument('appservice web create', 'name', options_list=('--name', '-n'), help='name of the new webapp')
-register_cli_argument('appservice web create', 'plan', options_list=('--plan',), completer=get_resource_name_completion_list('Microsoft.Web/serverFarms'),
+register_cli_argument('appservice web create', 'plan', options_list=('--plan', '-p'), completer=get_resource_name_completion_list('Microsoft.Web/serverFarms'),
                       help="name or resource id of the app service plan. Use 'appservice plan create' to get one")
 
 register_cli_argument('appservice web deployment user', 'user_name', help='user name')

CLI inconsistency -- to specify a parameters file, one must not use equal sign
If you use an equal sign between --parameters and the actual file path, you end up with the following:

```
az resource group deployment create --resource-group=jmsdcosrg --template-file=./output/azuredeploy.json --parameters="@./output/azuredeploy.parameters.json"
No JSON object could be decoded
```

Removing the equal sign works:

```
az resource group deployment create --resource-group=jmsdcosrg --template-file=./output/azuredeploy.json --parameters "@./output/azuredeploy.parameters.json"
```
diff --git a/src/azure-cli-core/azure/cli/core/tests/test_application.py b/src/azure-cli-core/azure/cli/core/tests/test_application.py
index aef479668..252fd558a 100644
--- a/src/azure-cli-core/azure/cli/core/tests/test_application.py
+++ b/src/azure-cli-core/azure/cli/core/tests/test_application.py
@@ -5,10 +5,14 @@
 
 import unittest
 
+import os
+import tempfile
+
 from six import StringIO
 
 from azure.cli.core.application import Application, Configuration, IterateAction
 from azure.cli.core.commands import CliCommand
+from azure.cli.core._util import CLIError
 
 class TestApplication(unittest.TestCase):
 
@@ -80,5 +84,32 @@ class TestApplication(unittest.TestCase):
         self.assertEqual(hellos[1]['hello'], 'sir')
         self.assertEqual(hellos[1]['something'], 'else')
 
+    def test_expand_file_prefixed_files(self):
+        f = tempfile.NamedTemporaryFile(delete=False)
+        f.close()
+
+        with open(f.name, 'w+') as stream:
+            stream.write('foo')
+
+        cases = [
+            [['--bar=baz'], ['--bar=baz']],
+            [['--bar', 'baz'], ['--bar', 'baz']],
+            [['--bar=@{}'.format(f.name)], ['--bar=foo']],
+            [['--bar', '@{}'.format(f.name)], ['--bar', 'foo']],
+            [['--bar', f.name], ['--bar', f.name]],
+            [['--bar="@{}"'.format(f.name)], ['--bar=foo']],
+            [['--bar=name@company.com'], ['--bar=name@company.com']],
+            [['--bar', 'name@company.com'], ['--bar', 'name@company.com']],
+        ]
+
+        for test_case in cases:
+            try:
+                args = Application._expand_file_prefixed_files(test_case[0]) #pylint: disable=protected-access
+                self.assertEqual(args, test_case[1], 'Failed for: {}'.format(test_case[0]))
+            except CLIError as ex:
+                self.fail('Unexpected error for {} ({}): {}'.format(test_case[0], args, ex))
+
+        os.remove(f.name)
+
 if __name__ == '__main__':
     unittest.main()

python scripts/dev_setup.py
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc libssl-dev libffi-dev
3.5
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
adal==0.4.3
applicationinsights==0.10.0
argcomplete==1.3.0
astroid==1.4.9
attrs==22.2.0
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli&subdirectory=src/azure-cli
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_context&subdirectory=src/command_modules/azure-cli-context
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_core&subdirectory=src/azure-cli-core
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp
-e git+https://github.com/Azure/azure-cli.git@c56c791d01985f1209d30849b55922d1adac85b5#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm
azure-common==1.1.4
azure-graphrbac==0.30.0rc6
azure-mgmt-authorization==0.30.0rc6
azure-mgmt-compute==0.32.1
azure-mgmt-containerregistry==0.1.0
azure-mgmt-dns==0.30.0rc6
azure-mgmt-iothub==0.1.0
azure-mgmt-keyvault==0.30.0
azure-mgmt-network==0.30.0rc6
azure-mgmt-nspkg==3.0.2
azure-mgmt-redis==1.0.0
azure-mgmt-resource==0.30.2
azure-mgmt-storage==0.30.0rc6
azure-mgmt-trafficmanager==0.30.0rc6
azure-mgmt-web==0.30.1
azure-nspkg==3.0.2
azure-storage==0.33.0
bcrypt==4.0.1
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
colorama==0.3.7
cryptography==40.0.2
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.6.1
jeepney==0.7.1
jmespath==0.10.0
keyring==23.4.1
lazy-object-proxy==1.7.1
mock==1.3.0
msrest==0.4.29
msrestazure==0.4.34
oauthlib==3.2.2
packaging==21.3
paramiko==2.0.2
pbr==6.1.1
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pycparser==2.21
Pygments==2.1.3
PyJWT==2.4.0
pylint==1.5.4
PyNaCl==1.5.0
pyOpenSSL==16.1.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
PyYAML==3.11
requests==2.9.1
requests-oauthlib==2.0.0
scp==0.15.0
SecretStorage==3.3.3
six==1.10.0
sshtunnel==0.4.0
tabulate==0.7.5
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.16
vcrpy==1.7.4
wrapt==1.16.0
zipp==3.6.0

name: azure-cli
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - adal==0.4.3
      - applicationinsights==0.10.0
      - argcomplete==1.3.0
      - astroid==1.4.9
      - attrs==22.2.0
      - azure-common==1.1.4
      - azure-graphrbac==0.30.0rc6
      - azure-mgmt-authorization==0.30.0rc6
      - azure-mgmt-compute==0.32.1
      - azure-mgmt-containerregistry==0.1.0
      - azure-mgmt-dns==0.30.0rc6
      - azure-mgmt-iothub==0.1.0
      - azure-mgmt-keyvault==0.30.0
      - azure-mgmt-network==0.30.0rc6
      - azure-mgmt-nspkg==3.0.2
      - azure-mgmt-redis==1.0.0
      - azure-mgmt-resource==0.30.2
      - azure-mgmt-storage==0.30.0rc6
      - azure-mgmt-trafficmanager==0.30.0rc6
      - azure-mgmt-web==0.30.1
      - azure-nspkg==3.0.2
      - azure-storage==0.33.0
      - bcrypt==4.0.1
      - cffi==1.15.1
      - charset-normalizer==2.0.12
      - colorama==0.3.7
      - cryptography==40.0.2
      - idna==3.10
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - isodate==0.6.1
      - jeepney==0.7.1
      - jmespath==0.10.0
      - keyring==23.4.1
      - lazy-object-proxy==1.7.1
      - mock==1.3.0
      - msrest==0.4.29
      - msrestazure==0.4.34
      - oauthlib==3.2.2
      - packaging==21.3
      - paramiko==2.0.2
      - pbr==6.1.1
      - pluggy==1.0.0
      - py==1.11.0
      - pyasn1==0.5.1
      - pycparser==2.21
      - pygments==2.1.3
      - pyjwt==2.4.0
      - pylint==1.5.4
      - pynacl==1.5.0
      - pyopenssl==16.1.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - pyyaml==3.11
      - requests==2.9.1
      - requests-oauthlib==2.0.0
      - scp==0.15.0
      - secretstorage==3.3.3
      - six==1.10.0
      - sshtunnel==0.4.0
      - tabulate==0.7.5
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.16
      - vcrpy==1.7.4
      - wrapt==1.16.0
      - zipp==3.6.0
prefix: /opt/conda/envs/azure-cli

src/azure-cli-core/azure/cli/core/tests/test_application.py::TestApplication::test_expand_file_prefixed_files
src/azure-cli-core/azure/cli/core/tests/test_application.py::TestApplication::test_application_register_and_call_handlers src/azure-cli-core/azure/cli/core/tests/test_application.py::TestApplication::test_list_value_parameter
src/azure-cli-core/azure/cli/core/application.py src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py
src/azure-cli-core/azure/cli/core/application.py src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/_params.py