WebApp authentication using az webapp auth set

Derek Pilat 1 Reputation point
2022-09-09T20:21:08.567+00:00

https://learn.microsoft.com/en-us/cli/azure/webapp/auth?view=azure-cli-latest#az-webapp-auth-set describes the command.
when trying to use it straight from the example - 'az webapp auth set -g myResourceGroup --name MyWebApp --body @auth.json'
I get error: The splatting operator '@' cannot be used to reference variables in an expression. '@auth' can be used only as an
argument to a command. To reference variables in an expression use '$auth'.

  • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
  • FullyQualifiedErrorId : SplattingNotPermitted

trying 'az webapp auth set -g myResourceGroup --name MyWebApp --body .\auth.json' gives me this error:
The command failed with an unexpected error. Here is the traceback:
Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 663, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 697, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 333, in call
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "C:\Users\derek.azure\cliextensions\authV2\azext_authV2\custom.py", line 113, in set_auth_settings_v2
json_object = json.loads(body)
File "json__init__.py", line 346, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

prior to running it I installed the authV2 extension.
My az cli configuration:
az --version
azure-cli 2.40.0

core 2.40.0
telemetry 1.0.8

Extensions:
authV2 0.1.1
azure-devops 0.25.0
azure-firewall 0.14.3

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\user.azure\cliextensions'

Python (Windows) 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 15:58:59) [MSC v.1929 32 bit (Intel)]

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,778 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 20,781 Reputation points Microsoft Employee
    2022-09-10T12:39:28.103+00:00

    @Derek Pilat Thank you for reaching out to Microsoft Q&A. Apologize for the inconvenience caused by this.

    Based on the above shared information, I have understood that you are trying to create authentication to your Webapp using Azure CLI cmdlet az webapp auth set from your local machine.
    Can you try passing the absolute path of the Json file to --body property in the cmdlet as shown below

    239668-image.png

    I have tested this from my end and it is working fine from my end and i would suggest you validate from your end as well.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.