diff --git a/azurelinuxagent/common/protocol/wire.py b/azurelinuxagent/common/protocol/wire.py
index 67a55203..5df35a98 100644
--- a/azurelinuxagent/common/protocol/wire.py
+++ b/azurelinuxagent/common/protocol/wire.py
@@ -1129,8 +1129,7 @@ class WireClient(object):
 
                         host = self.get_host_plugin()
                         uri, headers = host.get_artifact_request(blob)
-                        config = self.fetch(uri, headers, use_proxy=False)
-                        profile = self.decode_config(config)
+                        profile = self.fetch(uri, headers, use_proxy=False)
 
                     if not textutil.is_str_none_or_whitespace(profile):
                         logger.verbose("Artifacts profile downloaded")

Exception retrieving artifacts profile: TypeError: decoding str is not supported
I am tracking a annoying issue in the BVTs with the following signature.

```text
Exception retrieving artifacts profile: TypeError: decoding str is not supported
```

I increased debugging, and found this call stack.

```text
2018/04/18 06:03:51.919139 WARNING Exception retrieving artifacts profile: Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/azurelinuxagent/common/protocol/wire.py", line 1135, in get_artifacts_profile
    profile = self.decode_config(config)
  File "/usr/local/lib/python3.5/dist-packages/azurelinuxagent/common/protocol/wire.py", line 563, in decode_config
    xml_text = ustr(data, encoding='utf-8')
TypeError: decoding str is not supported
```

When I read the code for `get_artifacts_profile`, I noticed that decode_config is called twice.  The method `fetch` calls decode_config, and then `get_artifacts_profile` calls decode_config.  It appears that you cannot call decode_config twice with the same data.

The method decode_config is confusing because it has variables like xml_text, but the data passed in this case is actually JSON.  Azure does not do us any favors because some systems return XML and other returns JSON.  The agent could or should be smarter about this.

The bug was introduced with d0b583cc.
diff --git a/tests/protocol/test_wire.py b/tests/protocol/test_wire.py
index 34b82862..ffe72edf 100644
--- a/tests/protocol/test_wire.py
+++ b/tests/protocol/test_wire.py
@@ -342,7 +342,7 @@ class TestWireProtocol(AgentTestCase):
         wire_protocol_client.ext_conf.artifacts_profile_blob = testurl
         goal_state = GoalState(WireProtocolData(DATA_FILE).goal_state)
         wire_protocol_client.get_goal_state = Mock(return_value=goal_state)
-        wire_protocol_client.fetch = Mock(side_effect=[None, '{"onHold": "true"}'.encode('utf-8')])
+        wire_protocol_client.fetch = Mock(side_effect=[None, '{"onHold": "true"}'])
         with patch.object(HostPluginProtocol,
                           "get_artifact_request",
                           return_value=['dummy_url', {}]) as artifact_request:

pip install -e .
parse_log_pytest
pyasn1 pytest
apt-get update apt-get install -y gcc
3.4
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typing_extensions==4.1.1
-e git+https://github.com/Azure/WALinuxAgent.git@dc6db7594f3c0ee24e69fb63b3ad05a7ac3c035d#egg=WALinuxAgent
zipp==3.6.0

name: WALinuxAgent
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:
      - attrs==22.2.0
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyasn1==0.5.1
      - pyparsing==3.1.4
      - pytest==7.0.1
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/WALinuxAgent

tests/protocol/test_wire.py::TestWireProtocol::test_get_in_vm_artifacts_profile_host_ga_plugin
tests/protocol/test_wire.py::TestWireProtocol::test_getters tests/protocol/test_wire.py::TestWireProtocol::test_getters_ext_no_public tests/protocol/test_wire.py::TestWireProtocol::test_getters_ext_no_settings tests/protocol/test_wire.py::TestWireProtocol::test_getters_no_ext tests/protocol/test_wire.py::TestWireProtocol::test_getters_with_stale_goal_state
tests/protocol/test_wire.py::TestWireProtocol::test_call_storage_kwargs tests/protocol/test_wire.py::TestWireProtocol::test_download_ext_handler_pkg_fallback tests/protocol/test_wire.py::TestWireProtocol::test_fetch_manifest_fallback tests/protocol/test_wire.py::TestWireProtocol::test_get_host_ga_plugin tests/protocol/test_wire.py::TestWireProtocol::test_get_in_vm_artifacts_profile_blob_not_available tests/protocol/test_wire.py::TestWireProtocol::test_get_in_vm_artifacts_profile_default tests/protocol/test_wire.py::TestWireProtocol::test_get_in_vm_artifacts_profile_response_body_not_valid tests/protocol/test_wire.py::TestWireProtocol::test_report_vm_status tests/protocol/test_wire.py::TestWireProtocol::test_status_blob_parsing tests/protocol/test_wire.py::TestWireProtocol::test_upload_status_blob_default tests/protocol/test_wire.py::TestWireProtocol::test_upload_status_blob_host_ga_plugin tests/protocol/test_wire.py::TestWireProtocol::test_upload_status_blob_reports_prepare_error tests/protocol/test_wire.py::TestWireProtocol::test_upload_status_blob_unknown_type_assumes_block
azurelinuxagent/common/protocol/wire.py
azurelinuxagent/common/protocol/wire.py