Skip to content

"Request body is required or invalid" using set_security_group interaction #904

@cdriess

Description

@cdriess

Describe the bug
When using the interaction "set_security_group" from the AdminCenter API Task. We got an error regarding the Request Body (RequestBodyRequired).

the used yaml
please provide the yaml that you used. It helps you put the yaml like this:

(In the job
- task: ALOpsAdminCenterAPI@1
      displayName: 'Set security group'
      inputs:
        azure_tenant_id: '$(azure_tenant_id)'
        azure_app_client_id: '$(azure_client_id)'
        azure_app_client_secret: '$(azure_client_secret)'
        interaction: set_security_group
        security_group_id: '$(bc_deployment_security_group)'
        environment: '$(bc_deployment_environment)'

the output
Also the complete output is necessary for us to see what is going on. Also use backtics:

Starting: Set security group
==============================================================================
Task         : ALOps AdminCenter API
Description  : Interact with BC SaaS AdminCenter API
Version      : 1.473.9825
Author       : Hodor
Help         : Interact with BC SaaS AdminCenter API.
==============================================================================
*** Validate configuration
*** Task Inputs:

name                                  value                                   
----                                  -----                                   
azure_tenant_id                       OurTenantID    
azure_app_client_id                   xxxxxx    
azure_app_client_secret               ***
azure_app_client_certificate                                                  
azure_app_client_certificate_password                                         
username                                                                      
password                                                                      
checksecondsdelay                     30                                      
maxtries                              20                                      
interaction                           set_security_group                      
wait_for_operation                    True                                    
environment                           Deploying                               
target_environment                                                            
target_environment_type               Sandbox                                 
use_update_window                     False                                   
app_id                                                                        
accept_isv_eula                       False                                   
force_dependencies                    False                                   
confirm_delete_data                   False                                   
application_insightskey                                                       
security_group_id                     gr_BusinessCentral_Sandbox_Dev          



True
*** For documentation, please visit   : https://www.alops.be/documentation

*** ALOps License:
  * Licensed To: OurCompany (Per Run License)

*** Imported required PS-Functions
*** Parse Task Parameters
*** Creating API Connector with endpoint [https://api.businesscentral.dynamics.com/]
*** API Authentication: Using Azure OAuth Authentication [xxxxxx]
*** Get OAuth token for tenant [OurTenantID]
*** Communication: Service-2-Service (Client Secret)
Invoke-RestMethod -Method Post -Uri "[https://login.microsoftonline.com/OurTenantID/oauth2/token"](https://login.microsoftonline.com/OurTenantID/oauth2/token%22)
*** Interaction: set_security_group
Invoke-RestMethod -Method Get -Uri 'https://api.businesscentral.dynamics.com/admin/v2.24/applications/BusinessCentral/environments/Deploying/settings/securitygroupaccess'
Environment [Deploying]:


id          :  AnID
displayName : gr_BusinessCentral_Prod_with_External_Accountant


*** Setting Security Group ID for [Deploying]
Invoke-RestMethod -Method Post -Uri 'https://api.businesscentral.dynamics.com/admin/v2.24/applications/BusinessCentral/environments/Deploying/settings/securitygroupaccess'
##[error]Exception in BCConnector.PostAPIData: {"code":"RequestBodyRequired","message":"Request body is required or invalid."}
##[error]Exception in BCConnector.PostAPIData: {"code":"RequestBodyRequired","message":"Request body is required or invalid."}
Finishing: Set security group

Expected behavior
Set the security group without an error.

Screenshots
Not applicable

Additional context
I don't know if I do something wrong here, this interaction is not yet in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationfeedback

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions