Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification Hub Namespace update failed with BadArgument Exception #235

Open
ChrWeinert opened this issue Jul 15, 2024 · 12 comments
Open

Comments

@ChrWeinert
Copy link

We have a notification hub namespace that includes one notification hub.
During the replacement of the Google fcm message support we wanted to set the new FCM v1 settings through our bicep script.
Because these settings are only available in the "2023-10-01-preview" version, we updates our script to this version.

When running the deployment we get the following error

{
  "status": "Failed",
  "error": {
    "code": "BadArgument",
    "message": "Value cannot be null. (Parameter 'value')",
    "target": "value"
  }
}

Because we can´t get more detail information about this error, we made some tests within an empty resource group.
We created a new notification hub namespace with a notification hub and the FCM v1 setttings. Everything works fine.

346553955-ae1aaa9b-16f4-40ac-af80-8c159089b731

When we re-run the bicep we always get the same error.
346554446-a6213fb7-d73e-446e-9b41-791b81e24fa7

When we delete the notification hub namespace and re-run the script, everythings is working again.

It seems, there might be an issue when the deployment tries to update an existing notification hub namespace.
We tried this with the API Version "2023-09-01", but the error also happens here.

Maybe someone can help us to figure out what is going wrong and how we can update our existing notification hub (namespaces) without getting this error.

Best Regards
Christian

Here is the bicep script we use to reproduce the issue:

resource notificationHubNamespace 'Microsoft.NotificationHubs/namespaces@2023-10-01-preview' = {
  name: 'ntfns-mynotificationhubnamespace'
  location: resourceGroup().location
  sku: {
    name: 'Free'
  }
  properties: {
    namespaceType: 'NotificationHub'    
  }

  resource RootManageSharedAccessKeyAuthorizationRule 'AuthorizationRules' = {
    name: 'RootManageSharedAccessKey'
    properties: {
      rights: [
        'Listen'
        'Manage'
        'Send'
      ]
    }
  }

  resource notificationHub 'notificationHubs@2023-10-01-preview' = {
    name: 'ntf-myNotificationHub'
    location: resourceGroup().location
    
    resource DefaultFullSharedAccessSignatureAuthorizationRule 'AuthorizationRules' = {
      name: 'DefaultFullSharedAccessSignature'
      properties: {
        rights: [
          'Listen'
          'Manage'
          'Send'
        ]
      }
    }

    resource DefaultListenSharedAccessSignatureAuthorizationRule 'AuthorizationRules' = {
      name: 'DefaultListenSharedAccessSignature'
      properties: {
        rights: [
          'Listen'
        ]
      }
    }

    resource DefaultManageSendListenSharedAccessSignatureAuthorizationRule 'AuthorizationRules' = {
      name: 'DefaultManageSendListenSharedAccessSignature'
      properties: {
        rights: [
          'Listen'
          'Manage'
          'Send'
        ]
      }
    }

    resource DefaultSendListenSharedAccessSignatureAuthorizationRule 'AuthorizationRules' = {
      name: 'DefaultSendListenSharedAccessSignature'
      properties: {
        rights: [
          'Listen'
          'Send'
        ]
      }
    }

    resource DefaultSendSharedAccessSignatureAuthorizationRule 'AuthorizationRules' = {
      name: 'DefaultSendSharedAccessSignature'
      properties: {
        rights: [
          'Send'
        ]
      }
    }
  }
}

--- Origin Post ---

https://github.com/Azure/bicep-types-az/issues/2222

@MrBear141
Copy link

Any updates on this one? The bug is pretty critical, we can not add NotificationHub as part of our IaC flow.

@dtap001
Copy link

dtap001 commented Jul 30, 2024

Any update on this?

@dtap001
Copy link

dtap001 commented Jul 30, 2024

@MrBear141 did you solved it?

@Abhi-532
Copy link

Abhi-532 commented Aug 2, 2024

any update on this ?

@dtap001
Copy link

dtap001 commented Aug 2, 2024

@Abhi-532 shamefully the only solution is to export all of the device registration from your hub, delete it then deploy again and import the device registrations. I will never use any ms azure solution again...

@MrBear141
Copy link

the issue is very critical, IaC flow can not work properly. Can anyone from azure team give some info about the bug? If it is not gonna be fixed, we are gonna move to some other notification solution. Any info would be appreciated.

@jatin-sisodia
Copy link

Hi this is a confirmation from Azure team that we have a known Bug in Bicep Script for update operation @2023-10-01-preview'.
We are working on the fix.
If possible, it is recommended to use management apis until that bug is fixed
https://learn.microsoft.com/en-us/rest/api/notificationhubs/operation-groups?view=rest-notificationhubs-2023-09-01

Hope this helps!
Thanks

@bvegso
Copy link

bvegso commented Aug 28, 2024

i was recommended to revert the apiVersion for the namespace to 2017-04-01 and keep the rest at 2023-10-01-preview. it seems to re-deploy fine like that

 "resources": [
     {
       "type": "Microsoft.NotificationHubs/namespaces",
-      "apiVersion": "2023-10-01-preview",
+      "apiVersion": "2017-04-01",

while:

    {
      "type": "Microsoft.NotificationHubs/namespaces/notificationHubs",
      "apiVersion": "2023-10-01-preview",

etc.

@jatin-sisodia
Copy link

Hi @bvegso, Yes we can use older version i.e. 2017-04-01 but for usecases specifically to FcmV1, 2017-04-01 version does not support them. For all other use cases we can keep on continuing the older version as a workaround until the bug is fixed.

Thanks !

@bvegso
Copy link

bvegso commented Aug 29, 2024

the Microsoft.NotificationHubs/namespaces resource needs to be deployed with 2017-04-01 but everything else, including the Microsoft.NotificationHubs/namespaces/notificationHubs, which contains the FCMv1 credentials, can be deployed with 2023-10-01-preview. we have tested this and seemed to deploy fine
having said this, we are working with ARM templates, not sure if this is possible in Bicep

@eth-ellis
Copy link

Hi @jatin-sisodia, any update on how the fix is going?

@dtap001
Copy link

dtap001 commented Sep 13, 2024

@eth-ellis: use bvegso's solution. It will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants