diff --git a/sdk/storage/Azure.Storage.Blobs/src/Generated/BlobRestClient.cs b/sdk/storage/Azure.Storage.Blobs/src/Generated/BlobRestClient.cs
index c90fa1cc0c13..10a83b7aeacb 100644
--- a/sdk/storage/Azure.Storage.Blobs/src/Generated/BlobRestClient.cs
+++ b/sdk/storage/Azure.Storage.Blobs/src/Generated/BlobRestClient.cs
@@ -13370,7 +13370,7 @@ public partial class BlobContainerItem
///
/// Creates a new BlobContainerItem instance
///
- public BlobContainerItem()
+ internal BlobContainerItem()
: this(false)
{
}
@@ -14789,7 +14789,7 @@ public partial class BlobItem
///
/// Creates a new BlobItem instance
///
- public BlobItem()
+ internal BlobItem()
: this(false)
{
}
@@ -16059,7 +16059,7 @@ public partial class BlobServiceStatistics
///
/// Creates a new BlobServiceStatistics instance
///
- public BlobServiceStatistics()
+ internal BlobServiceStatistics()
: this(false)
{
}
@@ -16772,7 +16772,7 @@ public partial class BlockList
///
/// Creates a new BlockList instance
///
- public BlockList()
+ internal BlockList()
: this(false)
{
}
diff --git a/sdk/storage/Azure.Storage.Common/swagger/Generator/src/generator.ts b/sdk/storage/Azure.Storage.Common/swagger/Generator/src/generator.ts
index 5e93a2212e62..0d6476f06b44 100644
--- a/sdk/storage/Azure.Storage.Common/swagger/Generator/src/generator.ts
+++ b/sdk/storage/Azure.Storage.Common/swagger/Generator/src/generator.ts
@@ -877,6 +877,7 @@ function generateObject(w: IndentWriter, model: IServiceModel, type: IObjectType
}
// Instantiate nested models if necessary
+ const readonlyModel = Object.values(type.properties).every(p => (p).readonly);
const nested = (Object.values(type.properties)).filter(p => !p.isNullable && (isObjectType(p.model) || (isPrimitiveType(p.model) && (p.model.itemType || p.model.type === `dictionary`))));
if (nested.length > 0) {
const skipInitName = `skipInitialization`;
@@ -886,7 +887,7 @@ function generateObject(w: IndentWriter, model: IServiceModel, type: IObjectType
w.line(`/// `);
if (type.deserialize) {
// Add an optional overload that prevents initialization for deserialiation
- w.write(`public ${naming.type(type.name)}()`);
+ w.write(`${!type.public || !readonlyModel ? 'public' : 'internal'} ${naming.type(type.name)}()`);
w.scope(() => w.write(`: this(false)`));
w.scope(`{`, `}`, () => null);
w.line();
diff --git a/sdk/storage/Azure.Storage.Files/src/Generated/FileRestClient.cs b/sdk/storage/Azure.Storage.Files/src/Generated/FileRestClient.cs
index 3ad19eb27a61..6c521b4fb0a9 100644
--- a/sdk/storage/Azure.Storage.Files/src/Generated/FileRestClient.cs
+++ b/sdk/storage/Azure.Storage.Files/src/Generated/FileRestClient.cs
@@ -8180,7 +8180,7 @@ public partial class ShareItem
///
/// Creates a new ShareItem instance
///
- public ShareItem()
+ internal ShareItem()
: this(false)
{
}
diff --git a/sdk/storage/Azure.Storage.Queues/src/Generated/QueueRestClient.cs b/sdk/storage/Azure.Storage.Queues/src/Generated/QueueRestClient.cs
index 639e11fd1116..7808ba944c41 100644
--- a/sdk/storage/Azure.Storage.Queues/src/Generated/QueueRestClient.cs
+++ b/sdk/storage/Azure.Storage.Queues/src/Generated/QueueRestClient.cs
@@ -3539,7 +3539,7 @@ public partial class QueueItem
///
/// Creates a new QueueItem instance
///
- public QueueItem()
+ internal QueueItem()
: this(false)
{
}
@@ -4046,7 +4046,7 @@ public partial class QueueServiceStatistics
///
/// Creates a new QueueServiceStatistics instance
///
- public QueueServiceStatistics()
+ internal QueueServiceStatistics()
: this(false)
{
}