msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Set-MgBetaOrganizationBrandingBackgroundImage not working

Open AlyaKoni opened this issue 8 months ago • 1 comments

Describe the bug

Trying to upload the company bradning backgound image with:

Set-MgBetaOrganizationBrandingBackgroundImage -OrganizationId $AlyaTenantId -InFile $uplFile

Getting following error:

Set-MgBetaOrganizationBrandingBackgroundImage_Set: D:\WindowsPowerShell\Modules\Microsoft.Graph.Beta.Identity.DirectoryManagement\2.26.1\exports\ProxyCmdletDefinitions.ps1:128845:23
  Line |
128845 |          $scriptCmd = {& $wrappedCmd @PSBoundParameters}
       |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       | Uri is invalid for a PUT operation. The URI must refer to an entity.  Status: 405 (MethodNotAllowed) ErrorCode: Request_BadRequest Date: 2025-02-28T16:32:27  Headers:        
       | Cache-Control                 : no-cache Vary                          : Accept-Encoding Strict-Transport-Security     : max-age=31536000 request-id                    :     
       | d238facd-3e82-4069-8741-d45d8e908b30 client-request-id             : db1ea7a1-ac93-4a73-a9c1-2912890ffe41 x-ms-ags-diagnostic           :
       | {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PEPF000000C2"}} x-ms-resource-unit            : 1 Date
       | : Fri, 28 Feb 2025 16:32:27 GMT

The cmdlet to upload the background image for a specific locale works well:

Set-MgBetaOrganizationBrandingLocalizationBackgroundImage -OrganizationId $AlyaTenantId -InFile $uplFile -OrganizationalBrandingLocalizationId "en-US"

Expected behavior

The cmdlet should work like the one for localized

How to reproduce

Set-MgBetaOrganizationBrandingBackgroundImage -OrganizationId $AlyaTenantId -InFile $uplFile

SDK Version

Microsoft.Graph.Authentication 2.26.1 and Microsoft.Graph.Beta.Identity.DirectoryManagement 2.26.1

Latest version known to work for scenario above?

Never

Known Workarounds

No workaround available

Debug output

Click to expand log ``` [DBG]: PS D:\Repos\PFIBDO-ADM-CloudConfiguration> Set-MgBetaOrganizationBrandingBackgroundImage -OrganizationId $AlyaTenantId -InFile $uplFile -debug [CmdletBeginProcessing]: - Set-MgBetaOrganizationBrandingBackgroundImage begin processing with parameterSet 'Set'. [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'. [Authentication]: - Scopes: [Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, ChannelMessage.Send, Contacts.Read, CrossTenantInformation.ReadBasic.All, DelegatedPermissionGrant.ReadWrite.All, DeviceManagementApps.Read.All, DeviceManagementApps.ReadWrite.All, DeviceManagementConfiguration.Read.All, DeviceManagementConfiguration.ReadWrite.All, DeviceManagementManagedDevices.Read.All, DeviceManagementManagedDevices.ReadWrite.All, DeviceManagementRBAC.Read.All, DeviceManagementServiceConfig.Read.All, DeviceManagementServiceConfig.ReadWrite.All, Directory.AccessAsUser.All, Directory.Read.All, Directory.ReadWrite.All, Domain.ReadWrite.All, Group.ReadWrite.All, GroupMember.ReadWrite.All, openid, Organization.ReadWrite.All, Policy.Read.All, Policy.ReadWrite.AuthenticationMethod, Policy.ReadWrite.Authorization, Policy.ReadWrite.ConditionalAccess, Policy.ReadWrite.CrossTenantAccess, Policy.ReadWrite.DeviceConfiguration, Policy.ReadWrite.PermissionGrant, profile, RoleAssignmentSchedule.ReadWrite.Directory, RoleEligibilitySchedule.Read.Directory, RoleEligibilitySchedule.ReadWrite.Directory, RoleManagement.Read.All, RoleManagement.ReadWrite.Directory, SharePointTenantSettings.ReadWrite.All, TeamMember.ReadWrite.All, TeamsApp.ReadWrite.All, TeamsAppInstallation.ReadWriteForTeam, TeamsAppInstallation.ReadWriteSelfForTeam, TeamSettings.ReadWrite.All, TeamsTab.ReadWrite.All, User.Read.All, User.ReadWrite.All, UserAuthenticationMethod.Read.All, UserAuthenticationMethod.ReadWrite.All, WindowsUpdates.ReadWrite.All, email, OrganizationalBranding.ReadWrite.All].

Confirm Are you sure you want to perform this action? Performing the operation "Set-MgBetaOrganizationBrandingBackgroundImage_Set" on target "Call remote 'PUT /organization/{organization-id}/branding/backgroundImage' operation". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y Content type ============================ HTTP REQUEST ============================

HTTP Method: PUT

Absolute Uri: https://graph.microsoft.com/beta/organization/42d7e894-cb93-41a2-9cc5-d8ec360d735a/branding/backgroundImage

Headers: FeatureFlag : 00000003 Cache-Control : no-store, no-cache User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; de-CH),PowerShell/2025.0.0 SdkVersion : graph-powershell-beta/2.26.1 client-request-id : e42c9c34-8532-4bda-bf8f-5690f84b0c66 Accept-Encoding : gzip,deflate,br

Body: ����JFIF,,��Created with GIMP��C

��C �8��� ���� �>�8�Ls��V��{������|������~�]�!�At�>����S��3�et�LO��/��|��C�}��7�CH��m �I������0�YҰ�"�p�֪e���L�+za �)��Dt����0���DX�iX����J)3�s��ԑ Ҵ�Eb�@�Rok�2��޵���H��77=���E�Z[���=�J�2zL��ج�k?�|e�G�^������␦�C��CH�Hi�������ޕn��H?D�)�9�/�␦֊�&��0���~5���/X�ts^��p�u�@�,�-b�n�'�x-="/x��8��^? u]�̞�-�e���s�*}�Z�_����x�^3�V|�ܦ��ӝ1��3�Xa�m�z�j�=T���IäGH�:��)�y�ݤ�m�կ6�-�Ӫ�罝�����ٟ:@���e�l�ۗ"�J):o�J�z�Tꆡ�ӕfq��� �� �zE��M�W�-���i���L3�ǥ=�J���/�[�a�z��9o=��G�/�b�m�뚻s�k=��Jk�µ�d����C/���N���U!��4o� !�@�9�yo�;��\�? j�����_�1����ɽ�p�� nv��_̭�{T��y�RtT���+ͪ>����KI�ݙ��rs^�a��]����6�85���x$K' ^|��C�e5�Od+�k˲i����t<2�Rg�LKH�ij�2�~1ť[�k�������)��W�#9vgꆈ�ӻ�'��z���K�x7� �'[�x��0}b�ڢQ���ZO�N�'� ��N]�AY��\m^U�vs_�h�7�n�a��|�o�@z�l/��x��s���AI�9�6�s�];�T]OqiA�R;xZ�[�U1�P5�C� O1���m�h��-N{U���~��-Yîu��Y�kB�SD�_�x�:?S�<���瘨z���Ǿ�@|57�O�-m��@�2}��k��s��kM���d��c��˰^������J�z�8����K��7�-%ǥ�H��iam����x��Ls�5Ů.���CXpk2�i~�G,�:)ϐk3?m8րv���␦����:Usl�[����Z�]t�9�o�ڌ餮�9����.{}"a��Pp��R]5���f����:�ϝt␦C�J�zB5����uS5X�k����0������g5�ՠ:�p�۫Y�1�A�2޾^�G��[pk@�SC�!�n�3lE�eȴf�m�� �L��A�|�q���k�?\�ם���fǤ7J���C�]����9}�"��^9�g���F�����_3f��g^�����F�2��n�vՐ�O�Wcy�ךןeM�%��j�����C�i����^~�o�>�5ǟ�G�2����>�Ҧ角CMq�_iZ�����Z�=KťťE�h�]|���y�v�_!zza+�az���z+ls�1wg?��Y����k��a�ˑ␦3�J�zB5����ҹϮ�}#by��G)Vs�x��ej�Z�i8W��v�{Ki9w�:'��k�O��9ϐ�~�Ș����Z8�.v������@\5���= �|�ۘ�l?\�۞��ӧWF'␦�8�/3h���U��OI�y�yr�w�A�]�})ɦv륣������ҶF6�ޞ:�\s�d��otM#�@�ծx5��s,�)���w�y��� ���7Ǧ��򋏚�/],�m6�f�Z�h�i�-:U�M��z14�M6G��y�llm��3�k␦σL�۟F'I��0�h��Q}4�紫;g^���k�?\��e�xs^9x����~n����Rp�PtV��:�r��v����_y��~���k̳��*͢��V�üu�:o��;�9'Mqikco�����8��+뱼�r���BQI��o_�X�ms�������l��b/K���[�\׍^:�g^�h>K�w�� �-�W5�we4����]�רz)�x5˝�ƯMI��%�@�)��Zd���� Ӛ��j�׾~� ��^ܷ���Dz��s�l,m�<Ͳ�fy˳?��n{|�&��o�Τ޿���B�ʲ޲jLf�8�ϽT��B3�!ts^w�����K3�1ŦM�˛ ���X�k�����˥K�(�YXZ�޺ ��gU%�� XQ���,�mִ7U?F���&��b�=�Y�Z��L��N��חL�ߐ������{��+XmX��os�����1@�R�޾�y$H)?9rf>2{��膍�ӹY�}�x�-�{}�{��6��<�r␦g�O$�w���x��1x��/ �,�-Lt�-�\���������6�2�Iå�KS |�:�kaj�j�d�U�����] ���-(�V{�$T�+}4Ѫ����Ռ^��y�V���|�,�-u�+�eΰ� ߖ�n���v����������4�w�/�t��S�>�ssZ���GU!�GF�u�/�o�[��4/U+��� ˚�6��Zc��+�:\����y��bckÚ�I������:UY�������z�!�H��v�:o�H���ϑ�xd|����<�#�Q=T�^��7/5�u��w�k�c�xv�^�ڱ��=Оek+ ����k�{�ќzr�-�m␦�R���h%����V��ҳ�)���C@�i4�s?nqM ~�˖�&6���]�P.6����+It�������kZ��I����U]��Ԫ�罋��dr�ְ�"7�~@*M���>�脒�-�fT��V�C�em�j��Ŵ\���ӧUm�j�����ݱ�������L":EG�Hn���yO�9�0��zW;V�ڠ_����{���?�>�+�k �EI��3�AI��u��ڵv��ck� fn��p�~�yF�-"�a�G�@�,,mg�iFr?���s�ʴy��?GB��OR��Nq���-���=,G�)��zW;V�ڠK��������mpal�ۘ��O~�ЇZ��?����s���8Vr�jy�b�Oǥs�k}�'X���ٛ�0m_7lU�b����v�o�@��3vf��m��<@4w��խ����ksn����ͱO����Һڵ���mnal�ۘ6���)��'����-�{D4���'����ٛ�0�Be��r���ݤ�A���_��~���?��iD��#H�k^u�6ϙ�&��p��;gV V�%�g����¼J��K�c��␦Lb��ks�Criɴd���V����-��s�B��֖��|҅kXV� �8����]��r����+<+�C�Z�j�@��ݱO��Ks�3ǧ�Ζn��� ���u��j��9ofao̺UA5��4�z)Ű6���*����uW����� ���8�<vf�[\�����*��UoN=�r�oak/��>5���kî;�2 Ns��/�����~���J��ǦJ�2��hV�����݊M��l�ۜX�i�k����z!�,Lm�1ߣ��;]��ɽ�- m0�s�]�hM'�ME�Zs��I�9�|��ٛ�3�H$���|�ߘkns�Vp���5�e.��S�8u�=�ֻT����A���G ��y�s��s�H �V�ZR��p�4�rؾv�?�.U�Z�e�����{r�����������Iq��s�i �6�q�g��6���-������-0�؛���9/ �+M��8t�:����n����� �ղ<��U�;SK������=�fݤ�)��Td5���k��#�fci�3�{(�U�x��]�z!~�߭Y���Ħ�k�������@�:u�/�ߤ�2~^[��"w�ż��4��y���v\��ܗ���h�v�.������=�f vs�x�ɽ�q��\�? =p�␦��C .�k�JO�� �6���j��O�i � Z�}�������6��z�z��v�V�P��mAǬ�ڪ�駪'9�g�V���퍽y�U��[���V���w�@�0���E��������=�fv*�|␦�C/��j>-:��:�X��c���������x�$=������y�6ʯzO2�v��Q�T�9�Gt�1x�C�!脖�'�� �z�@^|���M␦N��N��^���^�㗀�zV[W�I�M␦��-"�޽:�lm�o̘���j��Ze.��␦@��zYm��c�a��� {���C��- m4���0Zpk��3��_��нT�����:Z�Z�R��7���m ɥם9�[O ܗ�K/����n�S�:�Z�-l�;\�۞���z9k�?\�ݞ��5�k��H�iXV�^����Mk��e�ܵ����� ӜZW���)%f��]�k�;s��Qp�U�[S Dt�/��L󛻖�{�1aci�S.�׺�)�M�x~�WoP�6��l�٘�C�Y��dt��Mx��N��V��?F���̽�כW�/�%������1���r�vz��L�ٜGH��kCN�����^�Ba��XZ=x��+�������;՛�F��=��Fq�^mZ�j���g�u*�D�d;���jƯ!ǧ��1�Z���[�kW�^]�EY��hؾv����?����^�:��α_mP4G%�␦Em�@�1���y�s�]6��?�2�H\�׸9��=1>KG��ˑh��rf<vr��:{�dTu�0�#�} }OUg�������~��?x�^+ݫ�[����E@v�6��1��+�˟-���� ����mֶFV�:)��s��o�[�^����m�WH�e8���e��|נ��*�z6�=�ͫfcj��f��B������J��ͳ��>�v�լ�!��&�"�ŴS���c�����{<�K�h�K�y&"���j�,v�?�g��#�[G/W���+v�2��B��fy�c?K�'�e����ݹs,Rqi�z��Ԥ�3l#�������"�өY�C�}d{��C�rmiY̒�Gtוh�Hm���Tꆯ��(��xt����6g��3�r�9o˕5�K␦׃\��d5'�����F���s������i%&i�� �ΚXyM����]#7�T"zG��=����G�C�y�>sk8��������{�@mo7l�ݔ�9���Z���|��G����ұڵ��j�(��B���v���czY4����kX��弆��)^�W�T�1��9����V���)w��Oŧ�&�ޔ�ED�9��6�����CEri��3␦���&z �S�x��ʀ뤳9�0�̈��S4��Z}T9v���H��␦��J����æz�WH֞~��M+�,\mzs#w�<�r?~\�~�:a�K.%� �S��4�ކ@'����M��t��~��- -Aåe�h����Ҝ���8t�z��B#� �x5�=��/.nk���}t����7���0�czy{e.��:F����X��ۑdv��v��'���X^ܷ�9����r�vP�cdy��oG Cs���␦���0����V��ր�� ����<�g��␦��N�& �Z�[�/�=�b��|�W~QM ��u�^�R\�GY��oD�R�ڠMqiJ�R�w�:;��K�0 Cs���CV�kQtR����@�^q��'nq� ���=�g�{!�J3����_5�.��N���]����hΚB����7�ګ�L/����~^�뮑+�<�����޸e��w��4��z�a�υx- m)�hn� ϖ�V6�:�^�P:M��y&��s�@�xt�z��k>k�M�����=��Zx���9�f���|�jͫ/���T����9��z~����ys[z\���1�M�I~v�q��z�=T���+Ǥ�+K��^�[�K����Lt�;u�?x S I)4?U������V��� ^snai�V��(��E��x��z���y�V�����4���[H�����2�q�Yb�m3ŦB�2�^;^ܺhK�L;����cm/�zo��U?�������9?�-m��U�s�fwg5�����␦#�H���vכ�n�Ά����h���=�u�U��� ��+�~�L�9��3,��"zEE�!:�j- DATA TRUNCATED DUE TO SIZE

============================ HTTP RESPONSE ============================

Status Code: MethodNotAllowed

Headers: Cache-Control : no-cache Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : 135bf8cb-6e05-4e1d-9046-d3697aeb57ad client-request-id : e42c9c34-8532-4bda-bf8f-5690f84b0c66 x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF000000E9"}} x-ms-resource-unit : 1 Date : Fri, 28 Feb 2025 16:38:06 GMT

Body: { "error": { "code": "Request_BadRequest", "message": "Uri is invalid for a PUT operation. The URI must refer to an entity.", "innerError": { "date": "2025-02-28T16:38:07", "request-id": "135bf8cb-6e05-4e1d-9046-d3697aeb57ad", "client-request-id": "e42c9c34-8532-4bda-bf8f-5690f84b0c66" } } }

Set-MgBetaOrganizationBrandingBackgroundImage_Set: D:\WindowsPowerShell\Modules\Microsoft.Graph.Beta.Identity.DirectoryManagement\2.26.1\exports\ProxyCmdletDefinitions.ps1:128845:23 Line | 128845 | $scriptCmd = {& $wrappedCmd @PSBoundParameters} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Uri is invalid for a PUT operation. The URI must refer to an entity. Status: 405 (MethodNotAllowed) ErrorCode: Request_BadRequest Date: 2025-02-28T16:38:07 Headers: Cache-Control : no-cache Vary : | Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : 135bf8cb-6e05-4e1d-9046-d3697aeb57ad client-request-id : e42c9c34-8532-4bda-bf8f-5690f84b0c66 x-ms-ags-diagnostic : | {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF000000E9"}} x-ms-resource-unit : 1 Date : Fri, 28 Feb 2025 16:38:06 GMT

Recommendation: See service error codes: https://learn.microsoft.com/graph/errors

</details>


### Configuration

[DBG]: PS D:\Repos\PFIBDO-ADM-CloudConfiguration> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

architecture x64

### Other information

_No response_

AlyaKoni avatar Feb 28 '25 16:02 AlyaKoni