azure appsettings with json file in azure cli - asp.net

When am Running below azure cli command:
az webapp config appsettings set -g az1xxxx-xxx-xxx-xxx-xx -n wexxx-xxx-xxx-xx --settings #appSettings.json
I'm getting error:
ERROR: not enough values to unpack (expected 2, got 1) Traceback (most
recent call last): File
"C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\knack\knack\cli.py",
line 197, in invoke File
"C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\commands__init__.py", line 373, in execute File
"C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\six\six.py",
line 693, in reraise File
"C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\commands__init__.py", line 347, in execute File
"C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core\commands__init__.py", line 182, in call File
"C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-core\azure\cli\core__init__.py",
line 440, in default_command_handler File
"C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-jvxpk9ku\azure-cli-appservice\azure\cli\command_modules\appservice\custom.py",
line 153, in update_app_settings ValueError: not enough values to
unpack (expected 2, got 1)
I'm trying to update the key values from JSON file.
JSON file:
[
{
"name": "keyp",
"slotSetting": false,
"value": "Val_updated"
},
{
"name": "key_new_via_cli",
"slotSetting": false,
"value": "Val_via_cli"
},
{
"name": "kevp",
"slotSetting": false,
"value": "Val_update"
},
]
Azure Cli version : 2.0.50

Have you tried to add double quotes to settings filename?
az webapp config appsettings set -g az1xxxx-xxx-xxx-xxx-xx -n wexxx-xxx-xxx-xx --settings "#appSettings.json"

Related

Unhandled Exception for Downloader for Reddit

Having difficulty downloading a series of results when using the GUI. I'm able to log into my account, find a user and/or subreddit, but when I download I only get 1 result and it say
ERROR: Failed to extract due to: Unsupported Domain
Have downloaded all of the requirements in the requirements.txt file but not sure how to resolve this issue. Latest logfile result below:
"levelname": "CRITICAL",
"asctime": "02/12/2023 02:12:47 PM",
"filename": "main.py",
"module": "main",
"name": "DownloaderForReddit.main",
"funcName": "log_unhandled_exception",
"lineno": 48,
"message": "Unhandled exception",
"exc_info": "Traceback (most recent call last):\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2276, in _wrap_pool_connect\n return fn()\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 363, in connect\n return _ConnectionFairy._checkout(self)\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 773, in _checkout\n fairy = _ConnectionRecord.checkout(pool)\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 492, in checkout\n rec = pool._do_get()\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/pool/impl.py", line 238, in _do_get\n return self._create_connection()\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 308, in _create_connection\n return _ConnectionRecord(self)\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 437, in init\n self.__connect(first_connect_check=True)\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 652, in __connect\n connection = pool._invoke_creator(self)\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect\n return dialect.connect(*cargs, **cparams)\n File "/home/ads/projects/DownloaderForReddit-master/venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 489, in c###
I think it has something to do with the SQLite package or lack there of. I'm very new to coding and trying to run on my linux machine in a virtual environment.

Runtime Error: Required "name" field not present in project

I used dbt init to create a profiles.yml in my .dbt folder. It looks like this:
spring_project:
outputs:
dev:
account: xxx.snowflakecomputing.com
database: PROD_DWH
password: password
role: SYSADMIN
schema: STG
threads: 1
type: snowflake
user: MYUSERNAME
warehouse: DEV_XS_WH
target: dev
Then, I created a new folder on my desktop which only contains a dbt_project.yml file that has this:
config-version: 2
profile: 'spring_project'
When I run this from my project folder:
dbt run --profiles-dir /Users/myusername/.dbt
I get this:
08:56:13 Encountered an error while reading the project:
08:56:13 ERROR: Runtime Error
Required "name" field not present in project
Error encountered in /Users/myusername/Desktop/spring_project/dbt_project.yml
08:56:13 Encountered an error:
Runtime Error
Could not run dbt
08:56:13 Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/dbt/task/base.py", line 108, in from_args
config = cls.ConfigType.from_args(args)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/runtime.py", line 226, in from_args
project, profile = cls.collect_parts(args)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/runtime.py", line 209, in collect_parts
project = partial.render(project_renderer)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/project.py", line 286, in render
return self.create_project(rendered)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/project.py", line 316, in create_project
dbt_version = _get_required_version(
File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/project.py", line 228, in _get_required_version
raise DbtProjectError(
dbt.exceptions.DbtProjectError: Runtime Error
Required "name" field not present in project
Error encountered in /Users/myusername/Desktop/spring_project/dbt_project.yml
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/dbt/main.py", line 129, in main
results, succeeded = handle_and_check(args)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/main.py", line 191, in handle_and_check
task, res = run_from_args(parsed)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/main.py", line 218, in run_from_args
task = parsed.cls.from_args(args=parsed)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/task/base.py", line 185, in from_args
return super().from_args(args)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/task/base.py", line 114, in from_args
raise dbt.exceptions.RuntimeException("Could not run dbt") from exc
dbt.exceptions.RuntimeException: Runtime Error
Could not run dbt
Where exactly am I missing the "name" parameter?
I am able to reproduce the same error as you. Based on dbt docs you need to add a name as well to your dbt_project file.
So change this:
config-version: 2
profile: 'spring_project'
to this:
name: testing_dbt
config-version: 2
profile: 'spring_project'
You can use whatever name you like there, but adding the name line fixes the error for me.

RuntimeException: Runtime Error Could not run dbt

I used dbt init to create a profiles.yml in my .dbt folder. It looks like this:
spring_project:
outputs:
dev:
account: xxx.snowflakecomputing.com
database: PROD_DWH
password: password
role: SYSADMIN
schema: STG
threads: 1
type: snowflake
user: MYUSERNAME
warehouse: DEV_XS_WH
target: dev
Now, I created a new folder on my desktop which only contains a dbt_project.yml file that has this:
profile: 'spring_project'
When I run this from my project folder:
dbt debug --config-dir
I get this:
21:48:59 Running with dbt=1.2.1
21:48:59 To view your profiles.yml file, run:
open /Users/myusername/.dbt
However, when I run dbt
dbt run --profiles-dir /Users/myusername/.dbt
I get this:
21:43:39 Encountered an error while reading the project:
21:43:39 ERROR: Runtime Error
Invalid config version: 1, expected 2
Error encountered in /Users/myusername/Desktop/spring_project/dbt_project.yml
21:43:39 Encountered an error:
Runtime Error
Could not run dbt
21:43:39 Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/dbt/task/base.py", line 108, in from_args
config = cls.ConfigType.from_args(args)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/runtime.py", line 226, in from_args
project, profile = cls.collect_parts(args)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/runtime.py", line 194, in collect_parts
partial = Project.partial_load(project_root, verify_version=version_check)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/project.py", line 639, in partial_load
return PartialProject.from_project_root(
File "/opt/homebrew/lib/python3.10/site-packages/dbt/config/project.py", line 485, in from_project_root
raise DbtProjectError(
dbt.exceptions.DbtProjectError: Runtime Error
Invalid config version: 1, expected 2
Error encountered in /Users/myusername/Desktop/spring_project/dbt_project.yml
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/dbt/main.py", line 129, in main
results, succeeded = handle_and_check(args)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/main.py", line 191, in handle_and_check
task, res = run_from_args(parsed)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/main.py", line 218, in run_from_args
task = parsed.cls.from_args(args=parsed)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/task/base.py", line 185, in from_args
return super().from_args(args)
File "/opt/homebrew/lib/python3.10/site-packages/dbt/task/base.py", line 114, in from_args
raise dbt.exceptions.RuntimeException("Could not run dbt") from exc
dbt.exceptions.RuntimeException: Runtime Error
Could not run dbt
What am I doing wrong?
Most likely the reason is lack of config-version:
dbt.exceptions.DbtProjectError: Runtime Error
Invalid config version: 1, expected 2
config-version
config-version: 2
Specify your dbt_project.yml as using the v2 structure.
Default:
Without this configuration, dbt will assume your dbt_project.yml uses the version 1 syntax, which was deprecated in dbt v0.19.0.

Google Cloud Composer authentication for BigQueryHook

I'm trying to make use of the BigQueryHook but I am unable to get the service account authentication working.
I've followed the steps provided by Google and have copied the JSON file into the data/ directory in the environment's GCS bucket.
The Airflow Connection details have been filled in:
JSON Keyfile Path: /home/airflow/gcs/data/my-key-file.json
Keyfile JSON: content of the JSON file
Scopes: https://www.googleapis.com/auth/cloud-platform
Error in stackdriver:
Traceback (most recent call last): File "/usr/local/lib/airflow/airflow/models.py", line 374, in process_file m = imp.load_source(mod_name, filepath) File "/opt/python3.6/lib/python3.6/imp.py", line 172, in load_source module = _load(spec) File "", line 684, in _load File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/airflow/gcs/dags/cloud_sql_to_bq.py", line 141, in df = get_config() File "/home/airflow/gcs/dags/cloud_sql_to_bq.py", line 71, in get_config bq_client = bigquery.Client(project=bq_hook._get_field("my-project"), credentials=bq_hook._get_credentials()) File "/usr/local/lib/airflow/airflow/contrib/hooks/gcp_api_base_hook.py", line 103, in _get_credentials key_path, scopes=scopes) File "/opt/python3.6/lib/python3.6/site-packages/google/oauth2/service_account.py", line 209, in from_service_account_file filename, require=['client_email', 'token_uri']) File "/opt/python3.6/lib/python3.6/site-packages/google/auth/_service_account_info.py", line 71, in from_filename with io.open(filename, 'r', encoding='utf-8') as json_file: FileNotFoundError: [Errno 2] No such file or directory: '/home/airflow/gcs/data/my-key-file.json'
Any idea why it can't see the JSON file?

AuthorizationFailed - "The client 'xxx' with object id 'xxx does not have authorization to perform action

I've tried to get Workspace from config which I do have access to, but it fails with the following error:
import azureml.core
print("SDK version:", azureml.core.VERSION)
from azureml.core.workspace import Workspace
ws = Workspace.from_config()
print(ws.name, ws.resource_group, ws.location, ws.subscription_id, sep='\n')
SDK version: 0.1.80 Found the config file in:
C:\Users\gubert\Repos\Gimmonix\HotelMappingAI\aml_config\config.json
get_workspace error using subscription_id=xxxxxxxxxxxxxxxxxxxxxxx,
resource_group_name=xxxxxxxxxxxx, workspace_name=gmx-ml-mapping
Traceback (most recent call last): File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml_project_commands.py",
line 320, in get_workspace workspace_name) File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml_base_sdk_common\workspace\operations\workspaces_operations.py",
line 78, in get raise
models.ErrorResponseWrapperException(self._deserialize, response)
azureml._base_sdk_common.workspace.models.error_response_wrapper.ErrorResponseWrapperException:
Operation returned an invalid status code 'Forbidden'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd_launcher.py",
line 38, in main(sys.argv) File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_main_.py",
line 265, in main wait=args.wait) File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_main_.py",
line 256, in handle_args run_main(addr, name, kind, *extra, **kwargs)
File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_local.py",
line 52, in run_main runner(addr, name, kind == 'module', *extra,
**kwargs) File "c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd\runner.py",
line 32, in run set_trace=False) File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_vendored\pydevd\pydevd.py",
line 1283, in run return self._exec(is_module, entry_point_fn,
module_name, file, globals, locals) File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_vendored\pydevd\pydevd.py",
line 1290, in _exec pydev_imports.execfile(file, globals, locals) #
execute the script File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_vendored\pydevd_pydev_imps_pydev_execfile.py",
line 25, in execfile exec(compile(contents+"\n", file, 'exec'), glob,
loc) File "c:\Users\gubert\Repos\Gimmonix\HotelMappingAI\test.py",
line 8, in ws = Workspace.from_config() File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml\core\workspace.py",
line 153, in from_config auth=auth) File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml\core\workspace.py",
line 86, in init auto_rest_workspace = _commands.get_workspace(auth,
subscription_id, resource_group, workspace_name) File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml_project_commands.py",
line 326, in get_workspace resource_error_handling(response_exception,
WORKSPACE) File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml_base_sdk_common\common.py",
line 270, in resource_error_handling raise
ProjectSystemException(response_message)
azureml.exceptions._azureml_exception.ProjectSystemException: {
"error_details": { "error": { "code": "AuthorizationFailed",
"message": "The client 'xxxxxxxxxx#microsoft.com' with object id
'xxxxxxxxxxxxx' does not have authorization to perform action
'Microsoft.MachineLearningServices/workspaces/read' over scope
'/subscriptions/xxxxxxxxxxxxxx/resourceGroups/CarsolizeCloud - Test
Global/providers/Microsoft.MachineLearningServices/workspaces/gmx-ml-mapping'."
} }, "status_code": 403, "url":
"https://management.azure.com/subscriptions/xxxxxxxxxxxxx/resourceGroups/CarsolizeCloud%20-%20Test%20Global/providers/Microsoft.MachineLearningServices/workspaces/gmx-ml-mapping?api-version=2018-03-01-preview"
}
Try using the newest SDK version 1.0.10, this is a fairly old preview version you're using. If you still have a problem, let me know as I work on this SDK.

Resources